Javatpoint Logo
Javatpoint Logo

Linux ls command

The ls is the list command in Linux. It will show the full list or content of your directory. Just type ls and press enter key. The whole content will be shown.


Below, you can see, after entering ls command, we got whole content list of /home/sssit directory.

linux ls command1

Linux ls command options

ls optionDescription
ls -aIn Linux, hidden files start with . (dot) symbol and they are not visible in the regular directory. The (ls -a) command will enlist the whole list of the current directory including the hidden files.
ls -lIt will show the list in a long list format.
ls -lhThis command will show you the file sizes in human readable format. Size of the file is very difficult to read when displayed in terms of byte. The (ls -lh)command will give you the data in terms of Mb, Gb, Tb, etc.
ls -lhSIf you want to display your files in descending order (highest at the top) according to their size, then you can use (ls -lhS) command.
ls -l - -block-size=[SIZE]It is used to display the files in a specific size format. Here, in [SIZE] you can assign size according to your requirement.
ls -d */It is used to display only sub directories.
ls -g or ls -lGWith this you can exclude column of group information and owner.
ls -nIt is used to print group ID and owner ID instead of their names.
ls --color=[VALUE]This command is used to print list as colored or discolored.
ls -liThis command prints the index number if file in the first column.
ls -pIt is used to identify the directory easily by marking the directories with a slash (/) line sign.
ls -rIt is used to print the list in reverse order.
ls -RIt will display the content of the sub-directories also.
ls -lXIt will group the files with same extensions together in the list.
ls -ltIt will sort the list by displaying recently modified filed at top.
ls ~It gives the contents of home directory.
ls ../It give the contents of parent directory.
ls --versionIt checks the version of ls command.

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA