问题
I want to find the non-readable files in my directory (eg the files with g-r). So I tried this:
find . -perm -g-r
It shows me all of the files?? So I tried this:
find . -perm -g+r
And it showed me only the readable files. It appears that -perm -g-r matches all files. I'm using CentOS 5.5. Am I doing something wrong? It doesn't look like -perm -g-r does anything useful.
回答1:
Try:
find . ! -perm -g+r
回答2:
If you want to find files that are non-readable by you, you could use
find . ! -readable
回答3:
You were able to see all files when you executed the below instruction, because you were executing it as root.
find . -perm -g-r
Try executing as a normal user.
来源:https://stackoverflow.com/questions/4382599/using-find-perm-to-find-when-a-permission-is-not-set