Looking for files NOT owned by someone

mike628 picture mike628 · May 8, 2011 · Viewed 94.8k times · Source

I'm looking to recursively look through directories to find files NOT owned by a particular user and I am not sure how to write this.

Answer

Mel picture Mel · May 8, 2011

The find(1) utility has primaries that can be negated ("reversed") using the "!" operator. On the prompt one must however escape the negation with a backslash as it is a shell metacharacter. Result:

find . \! -user foo -print