Listing files and permissions
ls -al # list files and display permissions
ll # list files and display permissions
stat -c '%A %a %n' * # list files and display permissions in decimal
find . -printf "%m %p\n # recursively list files and permissions in decimal
du -sh ./* # list directory contents with sizes in M, G
Setting permissions
chmod 755 dirname # set directory permissions
chmod 644 filename # set file permissions
find . -type d -exec chmod 755 {} \; # recursively set directory permissions
find . -type f -exec chmod 644 {} \; # recursively set file permissions
chmod u+w filename # give owner permission to write to file
chmod g+w filename # give group permission to write to file
chmod o+w filename # give group permission to write to file
chmod a+w filename # give everybody (u, g, o) permission to write to file
chmod g+x filename # give group permission to execute file
chmod ugo+rwx filename # give read write execute permissions to owner group others
chmod -R g+r directory # recursively give directory read permission to group
chmod -R g-r directory # recursively remove directory read permission from group
chmod -R g=r directory # recursively set group permission only to read
chmod o-rwx file # removes all permissions from others
Ownership
chown root filename # change file owner to root
chown root dirname # change directory owner to root
chown -R root dirname # change directory owner to root recursively
chown root:user filename # change file owner to root ant group to user
chown -R root:user dirname # recursively change directory owner to root and group to user
chown :user filename # set filename group to user
chgrp user filename # set filename group to user
chgrp user dirname # set dirname group to user
chgrp -R user dirname # set dirname group to user recursively
chown -v -R root:user filename # execute chown command and display results
chown --reference=file1 file2 # copy ownership properties from file1 to file2
chown --from=guest user filename # set file owner to user if file is owned by guest
chown --from=:guest :user filename # set file group to user if file belongs to group guest
chown --from=root:user user:root filename # set ownership to user:root if currently ownership is root:user