Free — no signup required

Viewing Permissions: The `ls -l` Command

2 min read

Reading the Permission Matrix

Before you can change permissions, you need to see what they currently are. ls -l displays detailed file information including permissions — for example, /etc/passwd typically shows something like -rw-r--r-- 1 root root 2847 Jan 10 14:23 /etc/passwd.

Reading that line left to right: the permission string, the hard link count, the owner, the group, the file size in bytes, the last modification time, and finally the filename.

For directories, ls -ld shows the directory's own permissions rather than listing its contents. A directory like /var/log typically shows drwxr-xr-x — the leading d marks it as a directory, and the three triads mean the owner can list contents, create/delete files, and enter (rwx), while the group and others can only list and enter (r-x) without creating or deleting anything.

Useful variants: ls -ln shows numeric UIDs/GIDs instead of resolved usernames, which matters for cross-system debugging where the same name may map to different IDs; namei -l reports the permissions of every directory component leading to a file in one shot, which is invaluable when tracking down where in a deep path access is actually being denied; and stat can print a file's permissions directly in octal instead of the symbolic rwx form when you need the exact numeric value.

Practical tip: When debugging permission issues in production, always check both the file's own permissions and every parent directory's permissions in the path. A common mistake is checking only the file while a parent directory blocks access — walking the whole path at once is the fastest way to catch this.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free