The way to list files in reverse order using `ls`?

Published on Aug. 22, 2023, 12:20 p.m.

To list files in reverse order using ls, you can use the -r flag. Here’s an example:

ls -r

This will list the files and directories in the current directory, but in reverse order.

If you want to sort by modification time and then list the files in reverse order, you can use the -t flag along with -r. Here’s an example:

ls -tr

This will list the files and directories in the current directory, sorted by modification time (oldest first), and then in reverse order (i.e., newest first).

Note that -r and -t are just a couple of the options for modifying the behavior of ls. There are many other flags that you can use to customize the output, such as -l for detailed file information, -a for showing hidden files, and -h for printing file sizes in a more human-readable format.

Tags:

ls