Bash 5 reference · Text and System Tools
chmod (Linux command)
Change file permissions with symbolic modes (u+x, go-w) or octal numbers (755, 644, 600), optionally recursively.
Bash 5
Syntax
chmod [-R] MODE FILE...
Parameters
| Parameter | Description |
|---|---|
u g o a |
User, group, others, all. |
+ - = |
Add, remove, set. |
755 / 644 / 600 |
Common octal modes. |
-R |
Recursive. |
Examples
touch run.sh key.pem
chmod u+x run.sh
chmod 600 key.pem
stat -c '%A %a %n' run.sh key.pem
Output
-rwxrw-r-- 764 run.sh -rw------- 600 key.pem
Run this on your computer — see “Get Started” for setup.
mkdir -p site/css; touch site/index.html site/css/a.css
chmod -R go-w site
find site -perm -o+w | wc -l
Output
0
Run this on your computer — see “Get Started” for setup.
Related
find· Find files and directories by name, type, size, age or permissions, and act on them with -exec, -delete or xargs.- Bash File Permissions · tutorial