What are other `ls` commands?

Here are some commonly used ls commands with their options:

  1. ls -a: Lists all files, including hidden files (those starting with a dot).

  2. ls -l: Lists files in long format, showing detailed information (permissions, owner, size, etc.).

  3. ls -h: Used with -l, it displays file sizes in a human-readable format (e.g., KB, MB).

    ls -lh
  4. ls -R: Recursively lists all files and directories in the current directory and its subdirectories.

    ls -R
  5. ls -t: Sorts files by modification time, showing the most recently modified files first.

    ls -lt
  6. ls -S: Sorts files by size, showing the largest files first.

    ls -lS
  7. ls -r: Reverses the order of the sort (e.g., shows the oldest files first).

    ls -lr
  8. 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!

0 Comments

no data
Be the first to share your comment!