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?
llls -lls -ltr
1 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:$ type ll ll is aliased to `ls -alF'-aoption is to show hidden files (will show.and..too)-loption is to show the output as a long list along with various attributes e.g. permissions, file sizes, use, group, modification time etc.-Fwill append one of*/=>@|to the entries, it is basically used to differentiate files from directories as it will append/to the directory entries
Example :
$ ll total 24 drwxrwxr-x 4 chayan chayan 4096 Jun 25 13:53 ./ drwxrwxr-x 3 chayan chayan 4096 Jun 25 13:34 ../ drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:35 data/ -rw-rw-r-- 1 chayan chayan 88 Jun 25 13:50 filenames.txtls -l: As mentioned earlier-lwill show the entries as a long list along with various attributes.Example:
$ ls -l total 16 drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:35 data -rw-rw-r-- 1 chayan chayan 88 Jun 25 13:50 filenames.txtls -ltr:-toption will sort the entries by modification date (with newest first)-rwill reverse the sorting order.
As
-twill sort by modification time with newest first,-rwill cause the reverse i.e. oldest entries will be shown first now.Example (Adding a file and a directory to make it clearer) :
$ ls -lt total 16 drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:50 log -rw-rw-r-- 1 chayan chayan 88 Jun 25 13:50 filenames.txt -rw-rw-r-- 1 chayan chayan 208 Jun 25 13:49 move.sh drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:35 data $ ls -ltr total 16 drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:35 data -rw-rw-r-- 1 chayan chayan 208 Jun 25 13:49 move.sh -rw-rw-r-- 1 chayan chayan 88 Jun 25 13:50 filenames.txt drwxrwxr-x 2 chayan chayan 4096 Jun 25 13:50 log
Check man ls to get more idea.