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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.