Q. How do I list or find all the files owned by a particular system user or group under Linux or UNIX operating system?
A. Only find command (search for files in a directory hierarchy) got options that allow you to search files owned by a specific user or groups.
Find file owned by group
Use following syntax:
find directory-location -group {group-name} -name {file-name}
Where,
- directory-location : Try to find files in this directory path
- -group { group-name} : Find file belongs to group-name.
- -name {file-name} : Actual name of file to search
For example, locate or find all file belongs to group "ftpusers" in /home directory, enter:
# find /home -group ftpusers
Find all *.c file belongs to group "ftpusers" in /data/project directory:
# find /data/project -group ftpusers -iname "*.c"
Find file owned by user
Use following syntax:
find directory-location -user {username} -name {file-name}
Where,
- directory-location : Try to find files in this directory path
- -user { group-name } : Find file belongs to username.
- -name {file-name} : Actual name of file to search
For example, locate or find all file belongs to user vivek in /var directory:
# find /var -user vivek
Find all *.pl files file belongs to user vivek in /var/www directory
# find /var/www -user vivek -name "*.pl"
See also:
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 12/14/07



{ 0 comments… add one now }