Julian Lannigan

Unix Chmod Recursive Directories and Files { 0 }

I came across a cool set of commands that I had a hard time finding on the net. Maybe it was because of my lack of sleep and poor search terms but who knows and who cares.

These commands will chmod all your directories and files within the current directory. Directories get 0755 permissions and files get 0644. This can come in handy if you ever upload something and the permissions are not set correctly.

find -type d -print0 | xargs -0 -I {} chmod 755 {}
find -type f -print0 | xargs -0 -I {} chmod 644 {}

I thank nixcraft of the nixcraft.com forums for the commands.

Be Sociable, Share!

Leave a Reply