15

How do I find files not belonging to particular group?

find /home -group NOT test
Michael
  • 397
  • 1
  • 7
  • 15

2 Answers2

22

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:
How do I master the UNIX find command?

Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448
-1

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

Dave Holland
  • 1,898
  • 1
  • 13
  • 18