How do I find all files that are *not* group writeable?

17

I see the following question describing how to find group writeable files: How can I find all PHP files with group write permissions?

But I want files that are not group writable! (Also, I couldn't comment on the above question).

Google lets me down (as 'find' isn't such a unique keyword).

Dan Bolser

Posted 2013-04-25T15:04:30.480

Reputation: 273

1Which OS is this for? – Brad Patton – 2013-04-25T15:06:57.250

I updated the tag based on the linked question. Please change if not correct. – Brad Patton – 2013-04-25T15:17:44.620

You can't comment on other people's posts until you have 50 rep, which is why you couldn't comment there. – ChimneyImp – 2013-04-25T15:32:45.693

Answers

25

Assuming that the linked question would run on your system, you can invert the match with !:

find ! -perm -g=w

Also, you can read the documentation for find by looking into the manpages:

man find

Darth Android

Posted 2013-04-25T15:04:30.480

Reputation: 35 133

6The full command to start searching within current directory would be find . ! -perm -g=w – ualinker – 2014-07-01T16:10:19.747

2Why would I look into man pages when superuser.com exists? – Dan – 2017-08-04T13:50:48.157

2

On BSD derived Unix system (macOS, FreeBSD, ...) you need to add a path to find. So for a more compatible version add . to search in the current directory and ! to invert the match:

find . ! -perm -g=w

Marián Černý

Posted 2013-04-25T15:04:30.480

Reputation: 156