How to Find Files Owned by a Specific User in Ubuntu (find -user)

The Ownership Audit

In Ubuntu Linux, tracking down files based on who created them is a fundamental security practice. If a junior developer named “john” leaves the company, you must locate every single script, configuration file, and private SSH key he generated across the entire server before you delete his account. If you simply run userdel john, you might leave thousands of “orphaned” files scattered across the hard drive, completely devoid of an owner and potentially vulnerable to unauthorized access. You must map the user’s footprint entirely before proceeding.

Using the find Command with -user

The Linux find command utilizes the -user flag to search the entire file system exclusively for files and directories that belong to a specific username.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To scan the entire server (/) and return the absolute path of every file owned by the user “john”, type the following command exactly:
  3. sudo find / -type f -user john
  4. Press Enter and provide your administrator password.

Cleaning Up Orphaned Data

Because you are searching the entire root file system, prefixing the command with sudo is mandatory to prevent the terminal from crashing with thousands of “Permission denied” errors. The search engine will recursively dig through all system directories and output a comprehensive list of John’s files. You can then pipe this command into an ownership change. For example, typing sudo find / -type f -user john -exec chown newadmin {} + will instantly transfer ownership of John’s entire digital footprint to the new system administrator in a single, seamless operation.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.