chmod -r uses symbolic mode. Specifically it removes read permissions for the file. Other forms include w for write and x for executable. + can be used to add permission.
ls -r actually lists entries in reverse order! It needs -R as well.
cp and rm accept either.
Looking at some man pages the only commands I found where -R didn’t work were scp and gzip where it doesn’t do anything, and rsync where it’s “use relative path names”.
(Caveat: BSD utils might be different, who knows what those devils get up to!)
Expectation: apply chmod to all subdirectories.
Reality: Remove read permission
For chmod, chown, chattr, etc,
-Ris used to recurse subdirectories.That’s what -R does in chmod as well? I feel like something here is going completely over my head. Or are you-all using another version of chmod?
chmod -ruses symbolic mode. Specifically it removes read permissions for the file. Other forms include w for write and x for executable. + can be used to add permission.https://ss64.com/bash/chmod.html
Aha! I didn’t get that you meant the issue was accidentally using
-rinstead of-Rsince both you and OP wrote the upper case one.I’m a lot more used to
-Rso I instead get caught off by commands where that means something other than recursive :)I mostly use symbolic mode and honestly don’t get why everyone else seems to use octal all the time.
People probably confuse it with tools like
cp,rm,ls, etc as they use-rfor file recursion.ls -ractually lists entries in reverse order! It needs-Ras well.cpandrmaccept either.Looking at some man pages the only commands I found where
-Rdidn’t work werescpandgzipwhere it doesn’t do anything, andrsyncwhere it’s “use relative path names”.(Caveat: BSD utils might be different, who knows what those devils get up to!)