home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 17.6 Be an Expert on find Search Operators Chapter 17
Finding Files with find
Next: 17.8 Exact File Time Comparisons
 

17.7 The Times that find Finds

The times that go with the find operators -mtime , -atime , and -ctime ( 17.4 ) aren't documented very well. The times are in days:

  • A number with no sign, for example, 3 (as in -mtime 3 or -atime 3 ), means the 24-hour period that ended exactly three days ago (in other words, between 96 and 72 hours ago).

  • A number with a minus sign ( - ) refers to the period since that time. For example, -3 (as in -mtime -3 ) is any time between now and three days ago (in other words, between 0 and 72 hours ago).

  • Naturally, a number with a plus sign ( + ) refers to the 24-hour period before that time. For example, +3 (as in -mtime +3 ) is any time more than three days ago (in other words, more than 96 hours ago).

Got that? Then you should see that -atime -2 and -atime 1 are both true on files that have been accessed between 48 and 24 hours ago. ( -atime -2 is also true on files accessed 24 hours or less ago.)

For more exact comparisons, use find -newer with touch ( 17.8 ) .

- JP


Previous: 17.6 Be an Expert on find Search Operators UNIX Power Tools Next: 17.8 Exact File Time Comparisons
17.6 Be an Expert on find Search Operators Book Index 17.8 Exact File Time Comparisons

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System