In linux, using bash, what's the easiest way to find files that were modified more than an hour ago but less than 3 days ago?
Surely, there's got to be an easy way to do this. I keep searching and can't find an easy solution.
Use -mtime option with the find command to search files based on modification time followed by the number of days. Number of days can be used in two formats.
Example 1: Find files whose content got updated within last 1 hour. To find the files based up on the content modification time, the option -mmin, and -mtime is used.
Find has -mtime and -mmin:
find . -mtime +3 -mmin -60
From the find manual:
Numeric arguments can be specified as:
+n for greater than n
-n for less than n
n for exactly n
This should suffice: find . -mtime -3 -mmin +60
I just tried it:
find ./ -mtime -3 -mmin +60 -exec ls -lhrt {} \; | awk '{print $5" "$6" "$7" "$8}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With