Here are some commonly used ls commands with their options:
-
ls -a: Lists all files, including hidden files (those starting with a dot). -
ls -l: Lists files in long format, showing detailed information (permissions, owner, size, etc.). -
ls -h: Used with-l, it displays file sizes in a human-readable format (e.g., KB, MB).ls -lh -
ls -R: Recursively lists all files and directories in the current directory and its subdirectories.ls -R -
ls -t: Sorts files by modification time, showing the most recently modified files first.ls -lt -
ls -S: Sorts files by size, showing the largest files first.ls -lS -
ls -r: Reverses the order of the sort (e.g., shows the oldest files first).ls -lr -
ls -d */: Lists only directories in the current directory.ls -d */
These options can be combined for more specific outputs. For example, ls -la lists all files in long format, including hidden ones. If you have any more questions or need further details, feel free to ask!
