Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I find files not belonging to particular group?

find /home -group NOT test
share|improve this question
up vote 9 down vote accepted

find /home -not -group test or find /home ! -group test

The exclamation inverts the match. From man find:

 ! expr True  if  expr  is false.  This character will also usually need

 -not expr
          Same as ! expr, but not POSIX compliant.

If you want the group it does belong to in the output:

find /home ! -group test -printf "%p:%g\n"

Some more information on using find:

share|improve this answer
+1 - didn't know you could do that. – Dave Holland Apr 15 '10 at 14:02
exactly what I want! Thanks – Michael Apr 15 '10 at 14:17
+1 -- good trick, didn't know this was an option either... :] – Kyle Smith Apr 15 '10 at 16:21

Do a grep excluding the things you don't want?

share|improve this answer
like how do I get the groups listed with find? I would appreciate an example – Michael Apr 15 '10 at 13:50
How about instead you use Kyle's answer, which is a better solution. – Dave Holland Apr 15 '10 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.