What are common `ls` options?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 04 2025
0160

Common ls options include:

  1. -a: Lists all files, including hidden files (those starting with a dot).
  2. -l: Displays detailed information about files and directories in a long format.
  3. -h: Shows file sizes in a human-readable format (e.g., KB, MB).
  4. -R: Lists subdirectories recursively, showing their contents as well.
  5. -S: Sorts files by size, largest first.
  6. -t: Sorts files by modification time, with the newest first.
  7. -r: Reverses the order of the sort.
  8. -X: Sorts files alphabetically by file extension.
  9. -1: Lists one file per line.

You can combine these options for more customized output, such as ls -alh to show all files with detailed information and human-readable sizes.

0 Comments

no data
Be the first to share your comment!