Today I accidentally changed permissions of all the files in some folder /usr/lib/git-core with the following command:
chmod o-rx *
At first I thought that I have broken my system, but in few minutes I remembered that I have the same distribution on some other machine, I listed the same folder on this machine and used the following commands to restore original permissions:
chmod o+rx * find -maxdepth 1 -type f -perm 645 -exec chmod o-x {} \;
645 means the files that initially were -rw-r–r— and became -rw-r–r-x. This two commands saved me a lot of time. After that I even count the number of files with all permission combinations:
find -maxdepth 1 -type f -perm 644 | wc -l find -maxdepth 1 -type f -perm 755 | wc -l find -maxdepth 1 -type f -perm -o=x | wc -l