Ls command in Linux/Unix examples and usage


(Lakshmi Prasanna) #1

ls commands in Linux is used to list items. Here are some of the most used ls commands which you will need to use in the command line with their descriptions.

ls command examples

Command What does it do
ls -a list all files including hidden file starting with ‘.’
ls --color colored list [=always/never/auto]
ls -d list directories - with ’ */’
ls -F add one char of */=>@
ls -i list file’s inode index number
ls -l list with long format - show permissions
ls -la list long format including hidden files
ls -lh list long format with readable file size
ls -ls list with long format with file size
ls -r list in reverse order
ls -R list recursively directory tree
ls -s list file size
ls -S sort by file size
ls -t sort items by time & date
ls -X sort items by extension name