Bash

Outputting the Number of Seconds Since the Last Update of Files in a Folder Using Bash

On the Bash programming language (scripting language) command line on Linux PC/server, this article introduces how to output the number of seconds since the last update of files in a folder.

Shou Arisaka
1 min read
Oct 1, 2025

On the Bash programming language (scripting language) command line on Linux PC/server, this article introduces how to output the number of seconds since the last update of files in a folder.

calc3 " "$( date +"%s" )" - "$( find /mnt/e/_downloads/ -type f -printf '%Ts\n' | sort -r | head -1 )" "
yuis ASUS /mnt/c/pg$ types calc3 pythonprint3

alias calc3='pythonprint3'

pythonprint3 ()
{
    python3 -c "print($1)"
}

Image

The following gives you how many hours have passed.

calc3 " ( "$( date +"%s" )" - "$( find /mnt/e/_downloads/ -type f -printf '%Ts\n' | sort -r | head -1 )" ) / ( 60 * 60 ) "
0.19111111111111112

Share this article

Shou Arisaka Oct 1, 2025

๐Ÿ”— Copy Links