Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux chmod command

Change file permissions. This example grants the owner execute permission.

GNU Coreutils

Syntax

Command form
chmod [OPTION]... MODE FILE...

Common options

7 options
OptionWhat it does
MODE (symbolic)Use forms such as u+x, go-w or a=rx.
MODE (numeric)Use octal digits such as 640 or 755.
-R, --recursiveChange permissions recursively (directories and contents).
-v, --verboseReport every processed file.
-c, --changesReport only files whose permissions changed.
-f, --silentSuppress most error messages.
--reference=FILEUse FILE's mode instead of MODE.

Usage examples

2 examples

Change file permissions. This example grants the owner execute permission.

chmod u+x ./script.sh

Set owner read/write and group read permissions.

chmod 640 ./secrets.txt

Notes

Recursive permission changes can expose or break files. Avoid applying a single mode blindly to mixed files and directories; inspect with ls -l first.