Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I find files not belonging to particular group?

find /home -group NOT test
share|improve this question

2 Answers 2

up vote 7 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"
./lots/573:root
...

Some more information on using find:
http://serverfault.com/questions/29489/how-do-i-master-the-unix-find-command

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

 
discard

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.