Dear all,
I want to know what exactly the below command does in linux box.


Command : ls -ltr


Is this command sort only the main folders or it sort including the subfolders.

Thankyou,

Regards,
Prem

Recommended Answers

With the ls command, the 'l' flag uses a longer listing format, 't' sorts by modification time and 'r' reverses the order of the sort.

To list folders recursively you'd need to use the 'R' flag!

Remember man pages are your friend.
To see all of the available …

Jump to Post

All 2 Replies

With the ls command, the 'l' flag uses a longer listing format, 't' sorts by modification time and 'r' reverses the order of the sort.

To list folders recursively you'd need to use the 'R' flag!

Remember man pages are your friend.
To see all of the available options for the ls command use: man ls

It only lists the files in the present working directory.

help gives a lot of useful information: ls --help

Here are the relevant lines output when I ran this command:

-l                               use a long listing format
-t                               sort by modification time, newest first
-r, --reverse                    reverse order while sorting
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.