Here are some common options for the ls command that enhance its functionality:
-
-l: Long format. Displays detailed information about each file, including permissions, owner, size, and modification date.ls -l -
-a: All files. Lists all files, including hidden files (those starting with a dot).ls -a -
-h: Human-readable. When used with-l, it shows file sizes in a more understandable format (e.g., KB, MB).ls -lh -
-R: Recursive. Lists all files and directories in the specified directory and its subdirectories.ls -R -
-t: Sort by modification time. Displays files sorted by the time they were last modified, with the most recently modified files listed first.ls -lt -
-S: Sort by file size. Lists files sorted by size, with the largest files first.ls -lS -
-r: Reverse order. Reverses the order of the sort (e.g., from Z to A or from newest to oldest).ls -lr
Example of Combined Options
You can combine options for more tailored output. For instance:
ls -laR
This command lists all files (including hidden ones) in long format and recursively through all subdirectories.
Feel free to ask if you need more details on any specific option!
