find files NOT belonging to group
How do I find files not belonging to particular group?
find /home -group NOT test
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?