0

I have a directory where a lot of bash scripts or .sh files exist. I want to change their permissions to 770 (rwxrwx---) with the chmod command.

How can I accomplish that?

2
sudo chmod 770 /path/to/your/folder/*.sh

This will set the file permissions to 770 for all .sh files in the directory /path/to/your/folder/

  • No need for -R in this case, would only lead to unintended changes if a directory with other files was named something.sh. – Tamas H. May 21 at 7:59
  • 1
    @TamasH. Thanks, you're right. Got carried away a little by the other answer. – Panki May 21 at 8:00
-1

Best way is using find command with the -exec option where you can use chmod.
$ find /my/bashfiles/ -type d -name *.c -exec chmod 770 {} \;
enter link description hereread below: https://www.poftut.com/set-permission-folders-subfolders-linux/

  • This command will find directories which end with .c, which is not at all what the OP asked. – Panki May 23 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.