Linux: Find User Files

How do I find out all files owned by a user called tom or jerry under UNIX / Linux / BSD / OS X operating systems?

Use the find command as follows to find all files owned by a user called tom, in /home (open terminal and type the command):

ADVERTISEMENTS

find /home -user tom
find /home -user jerry

To find all files in the /sales directory owned by the vip group, enter:

 find /sales -group vip

You can restrict your search to *.c (all c files only) for user tom as follows:

find /home -user tom -type f -name "*.c"

You can restrict your search to directories only as follows:

find /home -user tom -type d

Where,

  • -type d – Find only directories.
  • -type f – Find only files.
  • -name “*.c” – Find all file ending with .c extension.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Miguel Aug 24, 2012 @ 19:04

    Excelent! just what i’ve been looking for :)

  • Abraham Jan 13, 2014 @ 12:35

    Thanks a lot :)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.