🐧 How to find all files owned by a specific user in Unix / Linux

In some cases, you may need to search all files owned by a particular user on a Linux system.

There are times when some of the files owned by a user are outside of his home directory.

To find all files on a server owned by this user, run the following command.

find / -user $USERNAME 

Replace $ USERNAME the actual name of the user who owns the searched files.

This command will search the entire filesystem for files owned by a specific user.

So it will take a long time.

It is recommended to save the output to files instead of being displayed on the terminal.

find / -user $USERNAME > user-files.txt

All files owned by this user will be saved in the user-files.txt file.