ownership using find

There are different ways to recursively check the ownership of files for users specified in commands or except users mentioned in commands.

a) To find ownership of file for any user the following command will be used:

# find /var -user root -printf “%p %u\n”

Output: The command will show the files owned by user “root”.

Output

b) To find ownership of file for all users except specified user following command will be used:

# find /var -not -user root -printf “%p %u\n”

Output: The command will show the files owned by all users except user “root”.

Output - Except Root