About Linux FAQ

Browse More FAQs:

How do I find all the files owned by a particular user or group?

Posted by Vivek Gite [Last updated: December 14, 2007]

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:

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.