Find UNIX files modified within a number of days

Contributor Icon Contributed by qmchenry Date Icon September 4, 2003  
Tag Icon Tagged: UNIX


To find all files modified within the last 5 days:

find / -mtime -5 -print

The – in front of the 5 modifies the meaning of the time as “less than five days.” The command

find / -mtime +5 -print

displays files modified more than five days ago. Without the + or -, the command would find files with a modification time of five days ago, not less or more.

Previous recipe | Next recipe |
 
  • mebden
    Rather, that command finds files modified exactly 5 days ago.

    --Mark
  • qmchenry
    You are exactly right. Thanks for catching this error and pointing it out. I've corrected the recipe to include the less than and more than modifiers of the day count.

    Quinn
blog comments powered by Disqus