Find Files Modified in last N Minutes

I’ve been using Bash’s find command a lot more regularly lately. I’ve always been scared off by its syntax, but it’s great once you’ve learned it.

Today I learned how to filter the results by files changed in the last N minutes: the cmin flag:

1
2
3
4
5
 -cmin [-|+]n
 True if the difference between the time of last change of file
 status information and the time find was started, rounded up to
 the next full minute, is more than n (+n), less than n (-n), or
 exactly n minutes ago.

For example:

1
2
3
find . -cmin +5 # Files modified more than 5 minutes ago
find . -cmin -5 # Files modified less than than 5 minutes ago
find . -cmin  5 # Files modified exactly 5 minutes ago
Last updated on Feb 12, 2024 09:29 -0500
Feedback
FOOTER