Change permissions using find command

Last modified: February 24, 2020
You are here:
Estimated reading time: 1 min

On a Linux server, if you are in need of changing the permissions of a bulk amount of files or directories recursively, we can use ‘find’ command to do it. The steps are explained below:

1.Change to the directory in which you need to change the permissions.

2.The permission changes are different based on the situation we are having. If you need to change the permissions of all files inside the directory to 644 recursively,

please use the following:
find . -type f -exec chmod 644 {} ;

You can specify a specific directory in the following way as well:

find /home/abc/ -type f -exec chmod 644 {} ;

3.If you are looking to change the permissions of directories inside the current folder to 755, use the following:

find /home/abc/ -type d -exec chmod 755 {} ;

4.If you are looking to change the permissions of all files having 777 permissions only to 644, use the following:

find . -type f -perm 777 -exec chmod 644 {} ;

Use the same format for directories by changing the option f:

find . -type d-perm 777 -exec chmod 755 {} ;

Was this article helpful?
Dislike 0
Views: 18
Customer Services Contact

Need Help? Send a Ticket to our 24X7 Technical Support Team

Subtitle
Subscribe Newsletter

Subscribe to Casbay Newsletter for online tips, events and latest promotion !

Copyright © 2010 – 2020 Casbay Sdn. Bhd. (1042688-D). All Rights Reserved.

All Trademarks Are The Property of Their Respective Owner.