When i am using these commands , i am getting the same output but only order is getting changed for ls -ltr
command.
Can anyone please tell me what is the difference between the below commands?
ll
ls -l
ls -ltr
command linels
When i am using these commands , i am getting the same output but only order is getting changed for ls -ltr
command.
Can anyone please tell me what is the difference between the below commands?
ll
ls -l
ls -ltr
Best Answer
First of all, the mentioned commands do not generate the same output. Here are the details:
ll
: There is no command likell
, in Ubuntu it is an alias for the commandls -alF
. you can find it by:-a
option is to show hidden files (will show.
and..
too)-l
option is to show the output as a long list along with various attributes e.g. permissions, file sizes, use, group, modification time etc.-F
will append one of*/=>@|
to the entries, it is basically used to differentiate files from directories as it will append/
to the directory entriesExample :
ls -l
: As mentioned earlier-l
will show the entries as a long list along with various attributes.Example:
ls -ltr
:-t
option will sort the entries by modification date (with newest first)-r
will reverse the sorting order.As
-t
will sort by modification time with newest first,-r
will cause the reverse i.e. oldest entries will be shown first now.Example (Adding a file and a directory to make it clearer) :
Check
man ls
to get more idea.