Understanding ls command output

ls command provides information about a file.  In Linux everything is represented as a file. A sample output of ls -lh is give below.

ls command

Total: show total size of the folder.

File type: First field in the output is file type. If the there is a – it means it is a plain file. If there is d it means it is a directory, c represents a character device , b represents a block device.

Owner: This field provide info about the creator of the file.

Group: This filed provide info about who all can access the file.

File size: This field provide info about the file size. By default the ls -l command give output in bytes.

Other field are self explanatory.

Now permission can be divided into three parts: Owner, Group, Other

permissions

r: read permission
w: write permission
x: execute permission

Octal values are used to represent permissions.

4 -> read permission
2 -> write permission
1 -> execute permission

Example: If a file have 764 permission it means owner can do all operation on file, group can do read and write operation on file and other can read only the file

This entry was posted in Linux. Bookmark the permalink.

1 Response to Understanding ls command output

  1. Nono YoBinis's avatarNono YoBinis says:

    What about the + after the perms like:
    drwxrwxr-x+ 2 root root 4096 Dec 23 15:09 logs

    Like

Leave a comment