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

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

1 Answer

0 votes
by (233k 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