Find files modified in the last 5 days, no more than 2 levels deep in the current directory.

find . -type f -depth -3 -mtime -5
Ever wanted to find the most recently modified files, but couldn't remember exactly where they were in a project directory with many subdirectories? The "find" command, using a combination of "-mtime -N" and "-depth -D" can be used to find those files. If your directory structure isn't very deep, just omit the "-depth -D", but if your directory structure is very deep, then you can limit the depth of the traversal using "-depth -D", where "D" is the maximum number of directory levels to descend.
Sample Output
% find . -depth -3 -mtime -5 -type f
./Backup of mark-crystal-rehersal-invite.doc
./Backup of mark-crystal-rsvp.doc

By: totoro
2009-03-25 19:54:06

What Others Think

"Thanks for sharing the code that helps in finding files modified in the last 5 days and then I think this will be helpful in understanding the code and most of the post we can see a clear description is available and here also they have provided detailed information of it the page here
Dwyane · 54 weeks ago
Can search files Gta 5 download apk
CiaraCosima11 · 17 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: