Blog
Chmod command in Linux
with examples

Linux chmod command is used to change the access permissions of files and directories.
Chmod Command
Changes the access permissions of a file or directory. On Unix systems, permissions apply to:
- read (r)
- write (w)
- execute (x)
chmod syntax
chmod [options] [permissions] [file name]
chmod options
- -c, –changes : as verbose, but only reported when a change has occurred
- -f, –silent, –quiet : disable most error messages
- -v, –verbose : print information about each file being processed
- –no-preserve-root : do not treat the “/” directory in a special way (default)
- –preserve-root : deny recussive action on “/”
- –reference=GM_FILE : use permissions of GM_FILE instead of AUTHORIZATION value
- -R, –recursive : changes also to directories and files in subdirectories
- –version : output version information and exit
Numerical Shorthand chmod
Digit | Laws | Letter |
0 | No rights | — |
1 | Exercise | –x |
2 | Record | -In- |
3 | Recording and execution | -wx |
4 | Reading | r– |
5 | Read and Execute | r-x |
6 | Read and write | rw- |
7 | Read, write and execute | rwx |