August 1, 2023

Find files created or modified in the last days with find

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. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88