Using `find -perm` to find when a permission is not set

User1 picture User1 · Dec 8, 2010 · Viewed 70.2k times · Source

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.

Answer

jgr picture jgr · Dec 8, 2010

Try:

find . ! -perm -g+r