LS: Difference between revisions

151 bytes removed ,  6 years ago
no edit summary
m (1 revision imported)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1:
[[Category:Linux]]
__TOC__
 
<br />
LS command is used to list the files in a directory.
 
*LS Color Code:
{| class="wikitable"
Blue = Dir
|-
White = Files
! Task !! Command
Red = Backups
|-
 
| LS Color Code || Blue = Dir<br />White = Files<br />Red = Backups
| *Visual Classification of Files With Special Characters || ls -F
|-
ls -F
| Visual Classification of Files With Special Characters || ls -F
Details:
<nowiki>/ = directory</nowiki><br />
/ = directory
<nowiki>nothing = normal file</nowiki><br />
<nowiki> @ = link file</nowiki><br />
<nowiki> *</nowiki> = Executable file
 
|-
| *Display One File Per Line || ls -1
ls -1
|-
 
| *To view hidden files || ls -a
|-
ls -a
| Display File Size in Human Readable Format || ls -lh
 
|-
| *Display DirectoryFile InformationSize ||in lsHuman -ldReadable /etcFormat
ls -lh
|-
 
| Order Files Based on Last Modified Time || ls -lt
*Display Directory Information
|-
ls -ld /etc
| Order Files Based on Last Modified Time (In Reverse Order) || ls -ltr
 
|-
| Display*Order Files RecursivelyBased on ||Last lsModified -RTime
ls -lt
|-
 
| Useful ls Command Aliases || alias ll="ls -lh"<br />alias lv="ls -F"<br />alias ls="ls -F --color=auto"
| *Order Files Based on Last Modified Time ||(In lsReverse -ltOrder)
|-
ls -ltr
| To view a long list of all the files + directories and sub-directories recursively || ls -lR
 
|-
*Display Files Recursively
| To view a list of all the files with extensions only || ls *.*
ls -R
|-
 
| 'more' is a filter for paging through text one screenful at a time|| <nowiki>ls -a | more</nowiki>
| *To view a long list of all the files + directories and sub-directories recursively || ls -lR
|-
ls -lR
| List only directories || <nowiki>ls -l | grep ^d</nowiki>
 
|-
| *To view a list of all the files with extensions only || ls *.*
| List file sorted by modification time || ls -t<br />ls -tr (in Reverse Order)<br />ls -lhtr (Large, Human readable, Time sort, Reverse order)
ls *.*
|}
 
| '*more' is a filter for paging through text one screenful at a time|| <nowiki>ls -a | more</nowiki>
ls -a | more
 
*List only directories
ls -l | grep ^d
 
*List file sorted by modification time
ls -t
ls -tr (in Reverse Order)
ls -lhtra (Large, Human readable, Time sort, Reverse order,hidden)
 
*List file sorted by Size
ls -lS
ls -lSr (in Reverse Order)
ls -lhSra (Large, Human readable, Time sort, Reverse order,hidden)
 
<br />
;References
<references/>
<br />
<br />
<br />