Skip to content

Instantly share code, notes, and snippets.

@anavdesign
Created April 15, 2018 17:59
Show Gist options
  • Save anavdesign/273e52efc4f0243122bf79ed7b635c93 to your computer and use it in GitHub Desktop.
Save anavdesign/273e52efc4f0243122bf79ed7b635c93 to your computer and use it in GitHub Desktop.
CLI: Change Mode Permissions

Change Mode Permissions

Symbolic Notation Numeric Notation
---------- 0000 no permissions
---x--x--x 0111 execute
--w--w--w- 0222 write
--wx-wx-wx 0333 write & execute
-r--r--r-- 0444 read
-r-xr-xr-x 0555 read & execute
-rw-rw-rw- 0666 read & write
-rwxrwxrwx 0777 read, write, & execute

Recursively chmod only directories

find . -type d -exec chmod 755 {} \;

Recursively set the execute bit on every directory. The +X flag sets the execute bit on directories only

chmod -R a+X *

Recursively chmod only files

find . -type f -exec chmod 644 {} \;

Recursively chmod only PHP files (with extension .php)

find . -type f -name '*.php' -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment