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

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

1 Answer

+1 vote
by (348k 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
 


...