Change Permissions or Ownership of Files or Directories Recursively

Authored by

So I am always looking for the way to change all files or directories in a directory to a certain set of permissions.  Here are the following shell commands that you can use to accomplish it.

# For Directories
find ./ -type d -exec chmod 755 {} +
# For Files
find ./ -type f -exec chmod 644 {} +

To change the ownership of files recursively you can use the following command

chown -R username:groupname ./*

 

 

Other Code Snippets

Change Permissions or Ownership of Files or Directories Recursively

Code Snippet | Linux

Sometimes when you are moving files from one host to another, you have to change the files owner or permissions so the web server can utilize it properly.

Read More
Find Files by Size

Code Snippet | Linux

Here is a Linux command line that searches for files that are over a certain size so that you can find where you might be able to free up some space. Useful to find error_logs that have run amok.

Read More
Import MySQL from Command Line

Code Snippet | Linux | MySQL

Here is a method to import a SQL file into a database via the Linux command line.

Read More
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram