ls command is one of the most frequently used command in Linux. In this article, we’ll be discussing basic ls command.
1. List Files using ls with no option
without option we won’t be able to view details like file types, size, modified date and time, permission and links etc.
2. List Files With option –l
with -l option we would be able to view details like file types, size, modified date and time, permission and links etc.
Ex- ls -l
3. List Files With option –a or View Hidden Files
with -l option we would be able View Hidden Files including hidden file starting with ‘.’.
Ex- ls -a
4. List Files with Human Readable Format with option -lh
With combination of -lh option we can shows sizes in human readable format.
Ex- ls -lh
5. List Files and Directories with ‘/’ Character at the end
Using -F option with ls command, will add the ‘/’ Character at the end each directory.
Ex- ls -F
6. List Files in Reverse Order
Ex- ls -r
7. Recursively list Sub-Directories
ls -R option will list very long listing directory trees.
Ex- ls -R
8. Sort Files by File Size
With combination of -lS displays file size in order, will display big in size first.
Ex- ls -lS
For more details read this article Practical applications of ls command