I use for example to change everyone's permissions:
chmod 777 file
Now, what if I want to preserve the current permissions?
I know there's something like
chmod xx7 file
in case I'd only want to change the world permissions, but I can't work it out (forgot).
Thanks!
You can use the symbols
o
for others such as:,
or
You can use
-
to revoke or+
to grant the permissionr
,x
,w
, or any combination of them. Similarly, you can do this for useru
or groupg
.Khaled's answer is best: learn to use symbols.
If you really want something to set permissions like you want, you can write some sort of script to get the octal format of the permissions, strip off the last digit and substitute your own.
I suppose you can write some sort of bash script like (note: untested and has no input validation):
but, really, learn to use symbols in chmod.