In previous article, I have posted about Linux File hierarchy structure Link , please check if you haven't visited.
ls is one of basic commands which lists files/directories that one should know when working with Linux. It is used on daily basis even though we may not aware and never use of all the ls options that are available.
In this article, we will be seeing purpose and different ways of using ls commands with options in Linux.
ls with no options lists all the files and directories in a bare format with no other details like file size, owner, permissions, date and time.
ls -l will lists the available files and directories with details like file/directory name size, owner, permissions, date and time.
ls -a will lists hidden files available
You know ls -l will list files/directories along with size and other details. By adding h(Human Readable Format) to it, ls -lh will lists files/directory size in human readable format like bytes, Kb, Gb
ls -F will list files and add "/" at the end of directories
ls -r will list files/directories in reverse order
ls -R list all files that are available inside the sub-directories
ls -ltr will lists files and directories in reverse order with latest modification as last
ls -lS will lists the file size in order, by displaying big size first
Inode number is unique identification number that are assigned when new file/directory is created.
ls -i will display the inode number of a file/directory
ls --version will return the version of ls
ls --help will display the help page
ls -l /Dir_name will lists all the files/directories inside the defined directory
ls -n will display the UserID and GroupID of files/directories
Hope the above information is useful. :)