O'Reilly logo

SAMS Teach Yourself Unix in 10 Minutes by Robert Shimonski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding a File by Its Date

In some cases, you may not be able to recall what a file is named or what its extension is, but you may know what day you created it. Creation date is another searchable criterion that you can select. To search, you will need to adapt a “how many days ago” mentality because Unix will search for files that have been made since the time that you specify. Let's look at an example:

1.
Determine how many days ago your file was made.
2.
Choose a starting directory for the search.
3.
Use the find command with the -ctime option: find <starting directory> -ctime <how many days old> -print.

For example:

>find ~/ -ctime 5 -print

This command specifies that Unix should find a file in your home directory that is less than five ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required