chmod Shortcuts
Let’s say we have these files:
-rwxrwxrwx joe acctg wordmatic
-r--r--r-- joe acctg calcmatic
We’d like to remove write permission for the group
and others on
wordmatic, and add write and
execute permission for all users
on calcmatic.
Rather than try to figure out what the new permissions are
and do these commands:
chmod go=rx wordmatic
chmod a=rwx calcmatic
The chmod command literally lets us add and subtract
permissions from an existing set by using + or
- instead of =.
Thus, we can take away the first file’s write permission for the
group and
others with this command:
chmod go-w wordmatic
...and we can add write and execute permission to the second file for
all users with:
chmod a+wx calcmatic