chmod changes who may read, write and run a file. Learn how to read rwx, what numbers like 755 and 644 mean, and when to use +x instead, by running the commands in a real terminal in your browser.
Updated: 2026-09-05
chmod [options] mode file...
The mode is either a number such as 755, or a symbol such as +x.
Start by looking at the current permissions with ls -l.
$ ls -l
total 16
-rw-r--r-- 1 user user 27 Sep 5 15:00 deploy.sh
-rw-r--r-- 1 user user 10 Sep 5 15:00 README.md
drwxr-xr-x 2 user user 4096 Sep 5 15:00 scripts/
-rw-r--r-- 1 user user 14 Sep 5 15:00 secret.env
The ten characters on the left are the permissions.
| Position | Meaning |
|---|---|
| 1st | Type (- for a file, d for a directory) |
| 2nd to 4th | What the owner may do |
| 5th to 7th | What the group may do |
| 8th to 10th | What everyone else may do |
r is read, w is write, x is execute.
deploy.sh is -rw-r--r--, so it cannot be run yet.
+x adds the execute permission.
$ chmod +x deploy.sh
$ ls -l deploy.sh
-rwxr-xr-x 1 user user 27 Sep 5 15:00 deploy.sh
Three x characters appeared.
The symbolic form adds to or removes from what is already set.
A digit is read 4 plus write 2 plus execute 1.
| Digit | What it allows |
|---|---|
7 | Read, write, execute (4+2+1) |
6 | Read and write (4+2) |
5 | Read and execute (4+1) |
4 | Read only |
0 | Nothing |
Three digits cover owner, group and others in that order.
For something only you should read, that is 600.
$ chmod 600 secret.env
$ ls -l secret.env
-rw------- 1 user user 14 Sep 5 15:00 secret.env
In practice two combinations cover most files.
$ chmod 644 README.md
$ ls -l
total 16
-rwxr-xr-x 1 user user 27 Sep 5 15:00 deploy.sh
-rw-r--r-- 1 user user 10 Sep 5 15:00 README.md
drwxr-xr-x 2 user user 4096 Sep 5 15:00 scripts/
-rw------- 1 user user 14 Sep 5 15:00 secret.env
644 for ordinary files, 755 for things you run and for directories.
-R applies the mode to everything inside as well.
$ chmod -R 755 scripts
$ ls -l scripts
total 4
-rwxr-xr-x 1 user user 24 Sep 5 15:00 backup.sh
chmod is what you run when permissions turn out to be the reason something will not work.
| Situation | What you type |
|---|---|
| Make a script runnable | chmod +x deploy.sh |
| Keep a secret to yourself | chmod 600 .env |
| Put a file back to normal | chmod 644 notes.txt |
| Fix a directory of scripts at once | chmod -R 755 scripts |
Numbers replace, symbols adjust.
chmod 755 ignores what was there and sets the whole thing.
chmod +x only adds execute and leaves the rest alone, which is safer when something is already configured.
777 is not a fix.
It lets anyone write to the file.
Use it to prove a theory if you must, then put it back.
A missing file is an error.
$ chmod 777 nope.txt
chmod: cannot access 'nope.txt': No such file or directory
Sometimes the owner is the problem, not the mode.
In that case you need chown, not chmod.
ls -l tells you whose file it is.
webterm.appthis site
Advanced Terminal Commands
Learn commands for specific situations
learn.webterm.appa separate site

Commands stick when they show up in a real sequence of work, not one at a time. There is a course that builds them up in order.
See the course