How to change permissions folder and all its subfolders and files in linux

Changing the permissions of a folder and its subfolders and files is often used in Linux operations.

Usually, we make bulk permission changes for folders or specific files.

This article will share with you how to change file or folder permissions in bulk.

For example

To change all the directories and files to 755 (drwxr-xr-x):

➜ chmod -R 755 *

#OR

➜ chmod -R u=rwx,go=rx *

To change all the directories to 755 (drwxr-xr-x):

➜  find ~/Documents/blog/permission/folder -type d -exec chmod 755 {} \;

To change all the files to 755 (drwxr-xr-x):

➜  find ~/Documents/blog/permission/folder -type f -exec chmod 755 {} \;

To change the permissions of a specific name folder or file to 755(drwxr-xr-x):

➜  find ~/Documents/blog/permission/folder -name "*test.log" -exec chmod 755 {} \;

Add a Comment

Your email address will not be published.