How To Change File and Directory Permissions with Chmod Recursively

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-change-file-and-directory-permissions-with-chmod-recursively/
PINTEREST
PINTEREST
INSTAGRAM

We have an archive which is archived by someone else and we want to change file and directory permissions. In order to change all sub files and directories permissions we need to run chmod recursively. Recursively means please apply given permissions all given files and folders and their sub files and folders.

-R or –recursive Option

In order to change files and directories permissions recursively chmod provides recursive feature with -R or --recursive options. In this example we will change permissions to 720 recursively.

Check Current Permission

After we have converted read, write and execute permissions to 720 we can check the current status of the permissions with ls -l command. This will list new permissions in the first column.

Check Current Permission
Check Current Permission

Setting Recursive Permissions with Find Command

We can create similar effect to the recursive option of the chmod . We will use find command which is used to find and filter files and directories and than execute command with their names. We can list all or some of the files and directories with find and than run chmod command one by one to the filtered list. In this files we will change all files those ends with .txt extension to the 720 .

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-change-file-and-directory-permissions-with-chmod-recursively/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  How To Find Specified Strings In Files With Find Command In Windows From Command Line With Examples

Leave a Reply

Your email address will not be published.