ls ( List directory linux command tutorials )

 

  • ls stands for list directory contents.

  • It is similar to age old DOS – DIR command.

  • It is used as ls [OPTION] ….. [FILE]

  • List information about the Files ( the current directory by default). It sorts entries alphabetically if none of –sort is specified.

  • The snapshot below shows the output given by ls command in terminal

 

  • As seen in the snapshot some entries are shown in blue and the rest in white.

  • It should be noted that entries indicated in blue are directories and in white are files.

  • Following are the options for ls command.

Option

Description

-a

list hidden files.

-d

list the name of the current directory.

-F

show directories with a trailing '/'

executable files with a trailing '*'

-g

show group ownership of file in long listing

-l

long listing giving details about files and directories such as permission, creator name, file last modified by, Size in bytes, Time stamp and file name.

-R

list all subdirectories encountered

-t

List all files ordered by time modified.


 

border