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

I want to find unreadable files in my directory (e.g. files with gr). So I tried this:

find . -perm -gr

Does he show me all the files? So I tried this:

find . -perm -g+r

And he showed me only readable files. It seems that -perm -gr matches all files. I am using CentOS 5.5. Am I doing something wrong? It doesn't look like -perm -gr does anything useful.

+56
linux bash find
Dec 07 '10 at 23:05
source share
3 answers

Try:

find . ! -perm -g+r

+79
Dec 07 '10 at 23:13
source share

If you want to find files that are not readable to you , you can use

 find . ! -readable 
+19
Dec 07 '10 at 23:16
source share

You could see all the files when executing the instruction below, because you ran it as root.

 find . -perm -gr 

Try a regular user.

-3
May 03 '11 at 1:26
source share



All Articles