I came across this blog post which praises text modes for /bin/chmod.
There are two ways you can change file permissions in Unix – one is using
chmod‘s symbolic (text) modes (like
chmod ug+x file), the other is using the octal modes (like
chmod 0660 file). It turns out that symbolic modes are more powerful because you can mask out the permission bits you want to change! Octal permission modes are absolute and can’t be used to change individual bits. Octal modes are also sometimes called absolute because of that.
I have to agree, they are superior. However I feel like the article needs more examples. So here we go.
Use “u” for user, “g” for group, “o” for others, and “a” for all, or you can use a combination of letters, similar to how you do for access rights:
$ chmod ug+rw *.php
This will make all .php files in current directory readable and writable by both user and group.
Use several permission changes within one command. Just separate them by comma.
$ chmod a-rwx,ug+rw,o+r *.php
The above will reset permissions on all .php files to readable by all and writable only by user and group.
And my favorite and most used example, which would be tricky with octal permissions is the “X”. In recursive change mode, “X” will affect executable bit only on directories. Difference by illustration:
$ chmod -R a+x /some/path
The above will add executable bit to all files and folders under /some/path.
$ chmod -R a+X /some/path
But the above will add executable bit only to folders under /some/path. The files will remain as they are.