Change permissions or owner on all files Linux

So you have a directory and you want to change permissions on all files in the directory or directories but not the directories themselve it’s easy in linux

Assume the directory I want to start on is /local and I want everything under this directory to be chmod 644 then I would run

 

find /local -type f -exec chmod 644 {} \;

 

Or if I wanted to print out results first to check them

 

find /local -type f -print

 

Or if I wanted to change the owner to bob:bob

 

find /local -type f -exec chown bob:bob {} \;

 

How about you want to change directories only to 755?

 

find /local -type d -exec chmod 755 {} \;

 

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.