ls

ls (List): The ls command in Linux is used to list the contents of a directory. It displays files, directories, and their attributes, such as permissions, ownership, size, and modification time. By default, ls shows the names of files and directories in the current directory, but it can be used with various options to modify the output.

Common Options:

  • ls -l: Displays detailed information (long format), including permissions, number of links, owner, group, size, and modification date.
  • ls -a: Lists all files, including hidden files (those starting with a dot .).
  • ls -h: When used with -l, shows file sizes in human-readable format (e.g., KB, MB).
  • ls -R: Recursively lists directories and their contents.
  • ls -t: Sorts files by modification time, with the newest files first.

Example:

ls -lah
  • This command lists all files, including hidden ones, in a detailed format with human-readable file sizes.

Leave a Reply

Your email address will not be published. Required fields are marked *