PASSWORD RESET

Your destination for complete Tech news

How to sort ‘ls’ by modified date in Ubuntu/Debian?

1.2K 0
< 1 min read

To sort the output of the ‘ls’ command by modified date in Ubuntu/Debian, you can use the following command:

# sort the files by modified date
# showing latest files at the top
ls -lt

The options used are as follows:

  • -l: This option enables the long format, which provides more detailed information about the files and directories, including permissions, owner, group, size, and modification date.
  • -t: This option tells ‘ls’ to sort the list by modification time, with the most recently modified files or directories shown first.

Show the recently modified files at the bottom

# sort the files by modified date. 
# showing latest file at the bottom
ls -ltr

The output will show the files and directories sorted by their modification dates in ascending order (from oldest to oldest). The most recently modified items will appear at the top of the list.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.