Using chmod Intelligently
June 07, 2011 - 12:00 pm
"Just chmod -R g+rwx *!"
No. Don't do that. It will drive people mad. Or at the least, it will drive me mad.
Recursive chmod will adjust both directories and files. If you're setting the exec bit, chances are, you don't need a bunch of text files set executable. A simple find piped into xargs will allow you to selectively adjust directories or files instead of both:
find -type d -print0 | xargs -0 chmod <permissions> - Alter on directories only
find -type f -print0 | xargs -0 chmod <permissions> - Alter on files only