ivan
ivan

Reputation: 6322

How to use Bash to find files whose gid != a fixed uid?

I'm sure this is pretty basic, but I haven't figured it out yet— how would you use Bash to find all files in a directory for which the file's gid is different than its uid? I tried...

find $dir -user $uid -group !=$uid

...and was unsurprised when it didn't work. I haven't ventured beyond single commands with Bash yet, but maybe it's time.

Upvotes: 1

Views: 3498

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185760

You can try the following :

find . \( -uid $UID -a ! -group $UID \) -type f -ls

Upvotes: 3

Related Questions