I was trying to add execute permissions to sh files in a folder. For that I mistakenly used:find . -print0 -iname '*.sh' | xargs -0 chmod -v 744 and the output was :mode of `.' changed from 0755 (rwxr-xr-x) to 0744 (rwxr--r--)mode of `./codis.sh' changed from 0644 (rw-r--r--) to 0744 (rwxr--r--)mode of `./ne fil.sw' changed from 0644 (rw-r--r--) to 0744 (rwxr--r--)mode of `./.whois1.sh.swo' changed from 0644 (rw-r--r--) to 0744 (rwxr--r--)mode of `./new file' changed from 0644 (rw-r--r--) to 0744 (rwxr--r--)mode of `./ezik.sh' changed from 0644 (rw-r--r--) to 0744 (rwxr--r--)mode of `./.whois1.sh.swp' changed from 0600 (rw-------) to 0744 (rwxr--r--)mode of `./whois1.sh' retained as 0744 (rwxr--r--)I now know that the correct usage for the  find part was find .  -iname '*.sh' -print0So I created another find like so: find . \! -iname '*.sh'  -print0 | xargs -0 chmod 600 so that I may set back the permissions for non-sh files (yes, I see that some files have 644 perms, not 600 but it does not matter now). The output for this command is :chmod: cannot access `./ne fil.sw': Permission deniedchmod: cannot access `./.whois1.sh.swo': Permission deniedchmod: cannot access `./new file': Permission deniedchmod: cannot access `./.whois1.sh.swp': Permission deniedI used sudo too but still nothing...  I see I do not understand permissons properly... If I understand correctly I need x permisions  for directory direc too in order to execute commands in said directory.
Why can't I chmod these files that I could earlier?
permissions;find;chmod
Your find cmd also finds the current directory .. The rights of this directory will then be set to 600 and therefore you'll lose the rights to touch the files within this directory.So cd .., chmod 700 said directory and then run your reverting find, which now excludes the current directory, like this:find . \! -path . \! -iname '*.sh' -print0 | xargs -0 chmod 600