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

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

chmod [-R] MODE FILE...

Parameters

ParameterDescription
u g o a User, group, others, all.
+ - = Add, remove, set.
755 / 644 / 600 Common octal modes.
-R Recursive.

Examples

Symbolic and octal
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.

Remove write access recursively
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.

Was this page helpful?