views:

13

answers:

1

So I understand that a line such as:

find /var/log/ -mtime +60 -type f -exec ls -l {} \;

Will list all files in /var/log which were modified 60 days or more ago.

After reading through the find man page though I noticed:

 Measure  times  (for  -amin,  -atime,  -cmin, -ctime, -mmin, and 
 -mtime) from the beginning of today rather than  from  24  hours
 ago.   This  option only affects tests which appear later on the
 command line.

Can someone explain the rest? (-amin, -atime, -cmin, -ctime, -mmin) The man page itself does not seem to really declare what each of these do?

Some example questions which might help me understand:

  • Find files modified an hour or more ago?
  • Find files modified between 60 minutes and 10 minutes ago?
  • Find files modified 2 weeks ago?
  • Find files created in the last 5 minutes?
+1  A: 
  • Find files modified an hour or more ago?
-mmin +60
  • Find files modified between 60 minutes and 10 minutes ago?
-mmin -60 -mmin +10
  • Find files modified 2 weeks ago?
-mtime +7 -mtime -8
  • Find files created in the last 5 minutes?

Can't be done. POSIX has no specification for creation time.

These options are explained in the TESTS subsection of the EXPRESSIONS section of the find(1) man page.

Ignacio Vazquez-Abrams
Thanks, much appreciated. I suppose I needed to just read a bit more into it... my apologies. -mtime is days, and the +/-<#> is the quantity for that given first part in this case days, or -mmin then some given minutes.
Chris