12/11/2016 - 3:46 AM



change group ownership;

sudo chgrp -R admin /usr/local

change access permissions;

sudo chmod -R g+w /usr/local

restore original ownership/permissions;

sudo chown root:wheel /usr/local

give all users read/write/execute permissions;

sudo chmod a+x someFile

access class;

(u)ser, (g)roup, (o)ther, (a)ll


+(add), -(remove), =(exact)

access type;

(r)ead, (w)rite, e(x)ecute

absolute form;

400(r), 200(w), 100(x) - 040(r), 020(w), 010(x) - 004(r), 002(w), 001(x)

777 anyone can do anything (read, write, or execute)

755 you can do anything; others can only read and execute

711 you can do anything; others can only execute

644 you can read and write; others can only read

change permissions of current user;

chown $USER -R

change permissions of user and group;

sudo chown -R userName:userGroup -R /path/to/folder

give the owner rx permissions, not w;

chmod u=rx file

deny rwx permission for group, others;

chmod go-rwx file

give write permission to the group;

chmod g+w file

give execute permission to everybody;

chmod a+x file1 file2

combine with a comma;

chmod g+rx,o+x file

give group write permission to "myfile", leaving all other permission flags alone;

chmod g+w myfile

remove read and write access to "myfile", leaving all other permission flags alone;

chmod g-rw myfile

give full group read/write access to directory "mydir", also setting the set-groupID flag so that directories created inside it inherit the group;

chmod g+rwxs mydir

explicitly give user read/write access, and revoke all group and other access, to file 'privatefile';

chmod u=rw,go= privatefile

give group read write access to this directory, and everything inside of it (-R = recursive);

chmod -R g+rw .

change the ownership of this directory to group 'medi' and everything inside of it (-R = recursive). The person issuing this command must own all the files or it will fail;

chgrp -R medi .

substitute user identity;

su - root

execute command as another user;

sudo root

run a command with a different root directory;


run a command ignoring shell functions;