What is the `ls -l` command?

QuestionsQuestions8 SkillsProHello, Bash!Nov, 18 2025
0148

The ls -l command in Linux is used to list files and directories in a detailed format. The -l option stands for "long listing format," which provides more information about each file or directory compared to the standard ls command.

Output Format

When you run ls -l, the output typically includes the following columns:

  1. File Type and Permissions: The first character indicates the file type (e.g., - for a regular file, d for a directory) followed by the permissions for the owner, group, and others (e.g., rwxr-xr--).

  2. Number of Links: The second column shows the number of hard links to the file.

  3. Owner: The third column displays the username of the file's owner.

  4. Group: The fourth column shows the group name associated with the file.

  5. File Size: The fifth column indicates the size of the file in bytes.

  6. Modification Date and Time: The sixth column shows the last modification date and time of the file.

  7. File/Directory Name: The final column displays the name of the file or directory.

Example Command

ls -l

Example Output

-rw-r--r-- 1 user group  1234 Mar  1 12:34 example.txt
drwxr-xr-x 2 user group  4096 Mar  1 12:34 my_directory

In this example:

  • The first line shows a regular file (-) named example.txt with read and write permissions for the owner, and read permissions for the group and others.
  • The second line shows a directory (d) named my_directory with read, write, and execute permissions for the owner, and read and execute permissions for the group and others.

Using ls -l is helpful for understanding file permissions, ownership, and other attributes in a directory.

0 Comments

no data
Be the first to share your comment!