ls -r option lists all files and directories in the current directory in reverse order.
Syntax
$ ls -r [options] [file|dir]
Examples
Before using the ls -r option, let’s look at the default of the ls command.
In the following example, we use the ls -r option to list all files and directories in the current directory in reverse order.
➜ ~ ls -r
![](https://www.linuxcommands.site/wp-content/uploads/2021/10/image-21-1024x116.png)
In the above example, we use the ls -r option, but this is not easy to read.
In the following example, we use the ls -rl option to list all files and directories in the current directory in a long list in reverse order.
➜ ~ ls -rl
For better reading, we can add the – t option to sort by time based on the above options. Long listing format sorted by date / time in reverse order:
➜ ~ ls -rlt