August 1, 2023

Find files created or modified in the last days

In the shell, run:

$ find ~ -mtime 0

to display files created or modified within the last 24 hours.

$ find ~ -mtime 1

to display files created or modified between 24 and 48 hours ago.

$ find ~ -mtime -3 

to display files created or modified within the last 3 days.

$ find ~ -mtime +3 

to display files created or modified older than three day.

The option -mtime tells find to display files which were created or modified n*24 hours ago. Meaning that find counts the number of 24-hour periods that have elapsed since the file was created or modified. Decimals are ignored. You can read more about -mtime on the man page of find. Which you can display by running

$ man find

in the shell.

find is copyleft-licensed and was published in 1971.


personal computing command-line interface (cli) shell literacy gnu linux trisquel find office applications wiki

No affiliate links, no analytics, no tracking, no cookies. © 2016-2023 yctct.com. Content is licensed under CC BY-NC-SA 4.0 .