Monday, January 5, 2009

Searching or finding files owned by user

A few days back, I have to find in my machine files that belong to a user or to a group. The general form are like below:

# find location -user username -group groupname

To find files in / directory owned by user foo:

# find / -user foo

To find files in / directory owned by user in group bar:

# find / -group bar

To find files in directory / owned by user foo and group bar:

# find / -user foo -group bar

You can also use uid or gid
To find files belong to uid 500:

# find / -uid 500

To find files that belong to gid 500

# find / -gid 500

No comments: