CloudNerve Series: HOWTO - Find Most Recently Modified Files via BASH

3 years ago   •   1 min read


Do you have a need to find the most recently modified files in a directory?

Luckily the find utility has flags to easily explore a directory recursively and list recently modified files.

If you want to find modified files within ‘N’ days ago from the current directory.

# files within the last 24 hours (1 day)
find . -mtime -1

# files within the last 3 days
find . -mtime -3

And if you need a bit more granularity, you can specify this as minutes also.  Use commands like below to find files modified within the last ‘N’ minutes.

# within last hour
find . -mmin +60

# within last 12 hours
find . -mmin +720


find man page

baeldung, find recently changed files


Limit finds to files only

find . -type f -mmin +60

Spread the word