We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,451 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

ls -ltr command

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

3
Contributors
2
Replies
2 Months
Discussion Span
11 Months Ago
Last Updated
3
Views
prem2
Posting Whiz in Training
228 posts since Feb 2010
Reputation Points: 8
Solved Threads: 4
Skill Endorsements: 0

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

JasonHippy
Practically a Posting Shark
862 posts since Jan 2009
Reputation Points: 615
Solved Threads: 146
Skill Endorsements: 5

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
DavidB
Posting Whiz
309 posts since Jul 2006
Reputation Points: 48
Solved Threads: 16
Skill Endorsements: 16

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0699 seconds using 2.69MB