Find All The Files Owned By a Particular User / Group

Find file owned by a group

Use the following syntax:find directory-location -group {group-name} -name {file-name}

Where,

  • directory-location : Locate the file in this directory path.
  • -group {group-name} : Find the file belongs to group-name.
  • -name {file-name} : The file name or a search pattern

In this example, locate or find all files belongs to a group called “ftpusers” in the /home directory:

# find /home -group ftpusers

To find all *.c file belongs to a group called “ftpusers” in /data/project directory, run:

# find /data/project -group ftpusers -name "*.c"

OR do case insensitive search:

# find /data/project -group ftpusers -iname "*.c"
Find file owned by user

The syntax is: find directory-location -user {username} -name {file-name}
Where,

  • directory-location : Locate files or directories in this directory location.
  • -user { user-name } : Find the file belongs to user.
  • -name {file-name} : File name or pattern.

In this example, locate or find all file belongs to a user called “vivek” in /var directory:

# find /var -user vivek

To find all *.pl (perl files) file belongs to a user called “vivek” in /var/www directory, enter:

# find /var/www -user vivek -name "*.pl"

Leave a Comment