A bash function to show the files most recently modified in the named (or current) directory

function t { ls -ltch $* | head -20 ; }
Coming back to a project directory after sometime elsewhere? Need to know what the most recently modified files are? This little function "t" is one of my most frequent commands. I have a tcsh alias for it also: alias t 'ls -ltch \!* | head -20'
Sample Output
% t
total 79768
drwxr-xr-x  79 aks   staff   2.6K Feb 24 23:38 aspell6-en-6.0-0/
drwxr-xr-x@ 53 aks   staff   1.8K Feb 24 23:21 aspell-0.60.6/
-rw-r--r--@  1 aks   staff   1.7M Feb 24 23:14 aspell-0.60.6.tar.gz
drwxr-xr-x   3 aks   staff   102B Dec 15 23:24 finance/
drwxr-xr-x   4 aks   staff   136B Dec  9 14:29 dev/
drwxr-xr-x  12 aks   staff   408B Aug 28  2008 db/
drwxr-xr-x   4 aks   staff   136B Aug  7  2008 Palm/
drwxr-xr-x  26 aks   staff   884B Jan 28  2008 web/

By: totoro
2009-03-25 20:05:52

1 Alternatives + Submit Alt

What Others Think

ls -altr # list in chronological order (most recent shown last)
mpb · 637 weeks and 4 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: