How can I sort the output of ls by last modified date?

I can't find the answer on Google without digging around, an there is no answer on Stack Overflow either.

link|improve this question
17  
You guys need to chill - the answer isn't there on Google without digging around, and there isn't to my knowledge a duplicate on SO. Question asked, question answered, move on. – nearly_lunchtime Apr 9 '09 at 13:26
1  
Ehm... There actually is an answer on Google, it's right there in the ls man page. – Tom Wijsman Aug 28 '11 at 14:55
2  
@nearly_lunchtime, You should consider accepting the answer with 70 votes. It's not nice to leave questions as "unanswered" when they clearly are. – recluze Feb 16 at 1:58
feedback

migrated from stackoverflow.com May 30 '10 at 19:58

This question came from our site for professional and enthusiast programmers.

7 Answers

ls -t

or (for reverse, most recent at bottom):

ls -tr

The ls man page describes this in more details, and lists other options.

link|improve this answer
Thanks, the -r option was helpful. – Scott Warren May 9 '11 at 12:22
8  
Why not accepting it, then? – Massimo Oct 13 '11 at 7:54
feedback

Using -t:

ls -t
link|improve this answer
feedback

option: -t

link|improve this answer
feedback

Pass the -t flag:

$ ls -t
link|improve this answer
feedback

Try this "ls -ltr", will give you the recent to the end of the list

link|improve this answer
3  
how did you answer this almost 3 days before the question was asked? Tempted to upvote for Kreskin-like ESP. – glenn jackman Apr 8 '10 at 21:23
8  
@glenn jackman: The question is asked in year 2009, and this answer is belongs to 2010 – huseyint May 30 '10 at 12:45
feedback

Add:

alias lt='ls -Alhtr'

in $homedir/.bashrc

link|improve this answer
feedback

For a complete answer here is what I use: ls -lrth

Put this in your startup script /etc/bashrc and assign an alias like this: alias l='ls -lrth' Restart your terminal and you should be able to type l and see a long list of files.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown