How To Find Files On Ubuntu Using The Terminal

Finding files in the desktop version of Ubuntu is as simple as opening the Files application and utilizing the search function. However, when it comes to locating files via the terminal, the process becomes a tad more intricate. In such cases, the use of the find or locate commands become essential.

In the upcoming sections, we’ll dive into the usage of these tools to efficiently locate files on your Ubuntu system.

You Might Like: The Best Programming Languages For Your Raspberry Pi Projects

Utilizing the Find Command in Ubuntu

The find command is a staple in the Linux ecosystem, making it a reliable tool for searching files in Ubuntu, regardless of the version you’re using. Although have a comprehensive tutorial on the find command for Linux, here’s a brief overview of its key functionalities for Ubuntu:

find files on ubuntu using the terminal

Locating Files Within a Specific Directory

To find a file within a particular directory (and its subdirectories), use the following syntax:

find /path/to/directory/ -iname FILENAME

Replace /path/to/directory/ with the directory you wish to search and FILENAME with the name of the file. For a case-sensitive search, replace -iname with -name.

Example: To locate a file named nginx.conf within the /etc/ directory, use:

find /etc/ -iname nginx.conf

Searching for Files with Partial Names

If you only remember a part of the file’s name, you can still find it using wildcards (*). Place the wildcard before, after, or around the known part of the filename.

Example: To find all .conf files within the /etc/nginx/ directory, use:

find /etc/nginx/ -iname *.conf

You Might Like: The Ultimate Raspberry Pi Commands List

Searching the Entire Ubuntu System with Find

To search the whole system, start from the root directory (/) using a command like:

find / -iname FILENAME

Note: This requires superuser privileges, so you may need to use sudo.

Employing the Locate Command in Ubuntu

The locate command offers a simpler but less flexible alternative to find. It relies on a regularly updated database to provide instant search results.

Installing Locate on Ubuntu

First, ensure your package list is up-to-date:

sudo apt update

Then, install the locate package:

sudo apt install locate

Update the locate database:

sudo updatedb

Using Locate to Find Files

To search for a file using locate, simply use:


For a case-insensitive search, add the -i option:

locate -i FILENAME

Example: To find all instances of php.ini on your system, use:

locate php.ini

You Might Like: Changing The Default Raspbian Log In & Password


By now, you should have a good understanding of how to locate files in Ubuntu using the terminal. Whether you prefer the versatility of the find command or the speed of the locate command, both tools offer effective solutions for file searching in Ubuntu.

If you encounter any issues or have any questions, feel free to leave a comment below. For more Ubuntu tips and tricks, check out our other tutorials and guides on Linux usage.

Erik D

Leave a Comment

Your email address will not be published. Required fields are marked *