+3 votes
in Operating Systems by (60.2k points)

How can I sort the output of the Linux ls command by date and time?

1 Answer

+1 vote
by (355k points)
selected by
 
Best answer

Use 'ls' command with the option '-lt' to sort its output by the modification date and time of files/directories.

$ ls -lt

If you want to reverse the order of the sorting, use the option '-ltr'.

-t                         sort by modification time, newest first
-r, --reverse              reverse order while sorting
 


...