8 Basic use of ls or list command

List or ls command is one of the most frequently used command in Linux. In this article, we’ll be discussing a basic list or ls command.

1. List files using ls with no option

Without an option, we won’t be able to view details like file types, size, modified date and time, permission and links etc.


ls

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.


ls -l

3. List files with option –a or view hidden files

With -l option we would be able to View Hidden Files including hidden file starting with ‘.’.


ls -a

4. List Files with Human Readable Format with option -lh

With a combination of -lh option, we can shows sizes in a human-readable format.


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 of each directory.


ls -F

6. List Files in Reverse Order


ls -r

7. Recursively list Sub-Directories

ls -R option will list very long listing directory trees.


ls -R

8. Sort Files by File Size

With a combination of -lS displays file size in order, will display big in size first.


ls -lS

For more details read this article Practical applications of ls command

You May Also Like

About the Author: Pankaj Bisht