Linux ls Command

The ls command in Linux is used to list the contents of a directory. It provides various options to customize the output.

Common Options

Option Description
-a Displays all files, including hidden files (those starting with a dot).
-l Displays detailed information about each file, including permissions, owner, size, and modification date.
-h Displays file sizes in a human-readable format (e.g., KB, MB).
-R Recursively lists all files in subdirectories.
-r Reverses the order of the sort, displaying the oldest files first.
-t Sorts files by modification time, with the newest files first.
-S Sorts files by size, with the largest files first.
-i Displays the inode number of each file.
--color Displays files with color-coded output for easier identification.

Examples