chmod with Letters
U+x, g-w, o-r.
CH mod, short for change mode, changes a file's permissions. The friendliest way to use it is with letters, that read almost like a sentence.

- chmod changes permissions
- Use letters
- Reads like a sentence
Who, plus or minus, what
ACH mod rule has three parts. Who it's for, U for the user, G for the group, O for others, or A for all. Then plus, to add, or minus, to remove. Then which permission, R, W, or X. So U plus X means, give the owner execute permission.
Adding and removing
Our hello script can't be run yet. There's no X. CH mod U plus X adds execute for Sam. Now the first group shows RWX. Then CH mod O minus R removes read permission from others. The last group is all dashes now.
ls -l projects/scripts/hello.sh -rw-r--r-- 1 sam sam 40 Jan 5 09:00 projects/scripts/hello.sh chmod u+x projects/scripts/hello.sh ls -l projects/scripts/hello.sh -rwxr--r-- 1 sam sam 40 Jan 5 09:00 projects/scripts/hello.sh chmod o-r projects/scripts/hello.sh ls -l projects/scripts/hello.sh -rwxr----- 1 sam sam 40 Jan 5 09:00 projects/scripts/hello.sh
More examples
You can combine rules with commas, like U plus X comma G minus W. A plus R gives read to everyone. And dash R, for recursive, changes a whole folder and everything inside it. Be careful with that one.
| key | value |
|---|---|
| u+x,g-w | two rules at once |
| a+r | everyone can read |
| go-rwx | only the owner |
| -R | the whole folder |
Summary
CH mod with letters says who, plus or minus, and what. U plus X makes a file runnable for you. Next, the number form, that you'll see everywhere online.
Key takeaways- chmod u+x
- chmod o-r
- chmod -R for folders