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

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

1 Answer

0 votes
by (29.1k points)

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