How to interpret `ls -l` output?

QuestionsQuestions8 SkillsProYour First Linux LabNov, 06 2025
0112

The output of the ls -l command provides detailed information about files and directories in a long format. Here's how to interpret the output:

Example Output

-rwxr-xr-- 1 user group 1234 Jan 1 12:00 filename

Breakdown of the Output

  1. File Type and Permissions:

    • The first character indicates the type of file:
      • -: Regular file
      • d: Directory
      • l: Symbolic link
      • c: Character device
      • b: Block device
      • s: Socket
      • p: Named pipe (FIFO)
    • The next nine characters represent the permissions:
      • The first three (rwx) are for the owner:
        • r: Read permission
        • w: Write permission
        • x: Execute permission
      • The next three (r-x) are for the group:
        • r: Read permission
        • -: No write permission
        • x: Execute permission
      • The last three (r--) are for others:
        • r: Read permission
        • -: No write permission
        • -: No execute permission
  2. Number of Links:

    • The next number (1 in the example) indicates the number of hard links to the file.
  3. Owner:

    • The next field (user) shows the username of the file's owner.
  4. Group:

    • The next field (group) shows the group name associated with the file.
  5. File Size:

    • The next number (1234) indicates the size of the file in bytes.
  6. Last Modified Date and Time:

    • The next fields (Jan 1 12:00) show the last modification date and time of the file.
  7. File Name:

    • The last field (filename) is the name of the file or directory.

Summary

The ls -l command output provides a comprehensive view of file attributes, including type, permissions, ownership, size, and modification date, which are essential for managing files and directories in a Linux environment.

0 Comments

no data
Be the first to share your comment!