How to look for files belonging to a user in Linux

This is a bit embarrassing but how do you search for all files owned by a particular user in Linux? I need to look for files belonging to a user named wwwapps in Linux. How do I do that?

We use the find command.

To find all files on the Linux box owned by user named guru run the following command as root user

find / -user guru 

Next we search for all files owned by a particular user named foo in Linux and store those named into a file called user.file.txt

sudo find / -user foo > /root/user.file.txt

Only list files owned by a user named wwwapps

sudo find / -type f -user foo > /root/user.file.txt

Only list directories owned by a user named bar

sudo find / -type d -user foo > /root/user.file.txt

Find the file belongs to group-named nginx

sudo find / -group nginx > /root/user.file.txt
# file only #
sudo find / -type f -group nginx > /root/user.file.txt
# dir only #
sudo find / -type d -group nginx > /root/user.file.txt

See


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki