8 / 55 · 19 Linux & Command Line · Permissions and Processes← prev⊞ allnext →☰ Read as one page
2.2Reading Permission Strings
ls -la tests/
# -rw-r--r-- 1 qa dev 4096 Jan 15 10:00 login.spec.ts
# drwxr-xr-x 2 qa dev 4096 Jan 15 10:00 fixtures/
The permission string -rw-r--r-- breaks down as:
| Position | Meaning | Example |
|---|---|---|
| 1 | File type (- = file, d = directory, l = symlink) |
- |
| 2-4 | Owner permissions (read/write/execute) | rw- (read + write, no execute) |
| 5-7 | Group permissions | r-- (read only) |
| 8-10 | Others permissions | r-- (read only) |
Permission Values
| Symbol | Meaning | Numeric Value |
|---|---|---|
r |
Read | 4 |
w |
Write | 2 |
x |
Execute | 1 |
- |
No permission | 0 |
Numeric permissions are the sum of the values. For example:
rwx= 4 + 2 + 1 = 7 (full access)rw-= 4 + 2 + 0 = 6 (read + write)r--= 4 + 0 + 0 = 4 (read only)r-x= 4 + 0 + 1 = 5 (read + execute)