Recursive chmod in Linux and macOS

Here is how to recursively use the command-line utility chmod to change directory and file permissions in Linux and macOS easily. It uses a combination of the utilities ‘find’ and ‘chmod’. I use these popular techniques all of the time; I hope they help you.

These will recursively search the directory tree, starting at the current directory (‘dot’).

Recursively chmod 755 all directories only:

find . -type d -exec chmod 755 {} \;

Recursively chmod 644 all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;

Leave a comment

Your email address will not be published. Required fields are marked *