LS

From Network Security Wiki


LS command is used to list the files in a directory.

  • LS Color Code:
Blue =  Dir
White = Files
Red = Backups
  • Visual Classification of Files With Special Characters
ls -F

Details:

  / = directory
  @  = link file
  *  = Executable file
  • Display One File Per Line
ls -1
  • To view hidden files
ls -a
  • Display File Size in Human Readable Format
ls -lh
  • Display Directory Information
ls -ld /etc
  • Order Files Based on Last Modified Time
ls -lt
  • Order Files Based on Last Modified Time (In Reverse Order)
ls -ltr
  • Display Files Recursively
ls -R
  • To view a long list of all the files + directories and sub-directories recursively
ls -lR
  • To view a list of all the files with extensions only
ls *.*
  • more is a filter for paging through text one screenful at a time
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)


References





{{#widget:DISQUS |id=networkm |uniqid=LS |url=https://aman.awiki.org/wiki/LS }}