Lesson 8: File permissions — ls -l and chmod
Every file in Linux carries permissions: who may read it, change it, or run it. Three actions — r (read), w (write), x (execute) — for three groups: the owner, the group, and everyone else. The command ls -l shows these permissions, and chmod changes them. We'll focus on the most common scenario: yo
Permissions are like who holds a key to a room: read (r) is peeking inside, write (w) is changing things, and execute (x) is switching it on. ls -l shows who holds which keys, and chmod +x adds the 'switch-on' key.
- permissions (rwx)
- Three things you can do to a file: r read, w write/change, x execute. Each can be allowed or denied.
- owner / group / others
- Permissions are set separately for three groups: the file's owner, its group, and everyone else. In -rwxr-xr-- these are the three triplets.
- ls -l
- A long listing: for each file it shows the permissions, owner, size, and date. The first column like -rw-r--r-- is the permissions.
- chmod (+x)
- Changes permissions. chmod +x file adds execute permission — the usual way to make a script runnable.