The ls –help come with this args :
-t sort by modification time, newest first
You need to pass the -t option to the ls command to sort by time modified.
1 |
$ ls -lt |
Also if you want to reverse the order of the sort then use -r option.
1 |
$ ls -ltr |
Let see one example:
1 2 |
$ ls -ltr *.py Dec 30 18:16 test.py |
with iso time style
1 2 |
$ ls -ltr *.py --time-style=iso 12-30 18:16 test.py |
with full-iso time style
1 2 |
$ ls -ltr *.py --time-style=full-iso 2013-12-30 18:16:55.142174239 +0200 test.py |
with long-iso time style
1 2 |
$ ls -ltr *.py --time-style=long-iso 2013-12-30 18:16 test.py |