2

In Linux, is there a way to do a search for files owned by multiple users (or group(s) of users) with the "find" command?

Something like this?

find . -user john, akido
2

Try using the -o syntax like this:

find ./ -user john -o -user akido

For further references, check Linux / Unix: Find All The Files Owned By a Particular User / Group

If you want to check the files belonging to users of a specific group:

find ./ -group name_of_group
  • I had tried the -o a while back but im searching for files owned by each users of a sub group which is more than two. I never see to got that to work – user2079902 Sep 25 '13 at 22:15
  • I don't fully understand what you mean. If they belong to the same group, check what I just updated. – fedorqui Sep 25 '13 at 22:17
  • well its not necessarily a real group in linux just specific users who could be of different groups – user2079902 Sep 25 '13 at 22:21
  • That is not possible with basic find command. You can do some tricks, but the most recommendable thing is to use the first expression I posted. – fedorqui Sep 25 '13 at 22:22
  • hmmm but thanks that has helped a bit – user2079902 Sep 25 '13 at 22:25
2

A file can only be owned by one user.

You can look for groups with

find . -group xxy

or if you want to find files owned by john or akido

find . '(' -user john -o -user akido ')' ...
  • I meant the second case you stated. Could this be used for more than 2 users? – user2079902 Sep 25 '13 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy