Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to list files with 3 days years old. I found this one at stackoverflow:

find . -type f -printf "%-.22T+ %M %n %-8u %-8g %8s %Tx %.8TX %p\n" | sort | cut -f 2- -d ' ' | grep 2012

But I kind don't understand what the whole command means. I wonder if there is something short and simple to understand.

share|improve this question
up vote 5 down vote accepted

This should work

find . -type f -mtime -3


find         find files
.            starting in the current directory (and it's subdirectories)
-type f      which are plain files (not directories, or devices etc)
-mtime -3    modified less than 3 days ago

See man find for details


To find files last modified before a specific date and time (e.g. 08:15 on 20th February 2013) you can do something like

  touch -t 201302200815 freds_accident
  find . -type f ! -newer freds_accident
  rm freds_accident

See man touch (or info touch - ugh!)

This is moderately horrible and there may be a better way. The above approach works on ancient and non-GNU Unix as well as current Linux.

share|improve this answer
Red, just a curiosity, I'm reading the man find now, and I would like to list files older than today only, daystart it seems the right choice, but how do I pass the start date ? – Valter Silva Mar 4 '13 at 13:58
@Valter: the -daystart option uses today's date. At 08:00 on 4th March, find -mtime +3 finds files modified longer ago than 08:00 1st March. I think find -daytime -mtime +3 should find files modified longer ago than 00:00 1st March. – RedGrittyBrick Mar 4 '13 at 14:08
Typo in prior comment: s/daytime/daystart/. Also see update in answer. – RedGrittyBrick Mar 4 '13 at 14:24

Find supports intervals with -ctime and -mtime +/- arguments.


$ for y in {07..14};do \
  for m in {01..12};do \
  for d in {01..30};do \
    touch -t 20$y$m${d}0101 $y$m$d.file ;done;done;done

$ find . -mtime +0 -mtime -$(( 3 * 365 + 3 )) |sort 

If you wanted files created a in the interval between 3 years and 3 days ago upto a week ago you would use -mtime +7 -mtime -1098.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.