Recursive file permission to only Directories/Files in Ubuntu

Suppose, you think that you just copied a large directory or application or files to any other place inside your operating system.
Then you need to change the file permission to all the files or to all the directories
recursively in your Ubuntu operating system.

In this case, don’t worry I will show you how to set recursive directories only or files only permission
from your terminal in Ubuntu.

Simply open your terminal and write down the following command to set permission
to only directories recursively.

find /opt/lampp/htdocs -type d -exec chmod 755 {} +

In the above command all directories under /opt/lampp/htdocs will be assigned with 755 (-rwxr-xr-x) permission sets recusively.

find /opt/lampp/htdocs -type f -exec chmod 644 {} +

In the above command all files under /opt/lampp/htdocs will be assigned with 644 (-rw-r–r–) permission sets recusively.

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.

Site Footer