Find files modified in the last N days; list sorted by time

find . -type f -mtime -14 -exec ls -ltd \{\} \; | less
What *have* I been working on for the last 2 weeks...
Sample Output
-rw-r--r-- 1 george george 75 2010-05-24 07:37 ./.update-notifier/hooks_seen
-rw-r--r-- 1 george george 61440 2010-05-14 15:54 ./.pulse/bfd54adae3f2c2b797ed9b374b0d221f-device-volumes.tdb
-rw-r--r-- 1 george george 42 2010-05-27 07:33 ./.pulse/bfd54adae3f2c2b797ed9b374b0d221f-default-source
-rw-r--r-- 1 george george 43 2010-05-27 07:33 ./.pulse/bfd54adae3f2c2b797ed9b374b0d221f-default-sink
-rw------- 1 george george 6917 2010-05-27 06:09 ./.recently-used.xbel

0
By: eludom
2010-05-27 14:54:23

What Others Think

files a sorted within directories, not globaly. a previous command i wrote about sorting files by directory could be used by adding the -mtime in find.
pepin · 489 weeks and 3 days ago
more wrong than i wrote previously. list is not sorted by time, it's wrote in the order "find" find them. cause ls -ltd is executed on each files individualy, not on the result of the find. you can run the command by replacing -exec ls -ltd ... by -ls and you'll see the same result, thus proving that the ls -ltd don't sort files.
pepin · 489 weeks and 2 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: