How to find files in Ubuntu? [SOLVED]

Omer Cakmak


Operating systems have both user-created files and the system's own files. Operating system files are placed in a systematic way. For example, the configuration files are in the /etc/ directory and the log files are in the /var/log directory. Files and system files created by the intervention of users can be moved to different places. Therefore, the need to find files arises.

In this article, we will give you information about searching for files on Ubuntu.

Let's talk about methods for searching files both via GUI and terminal.


Method-1: Find Files Using Gnome Files

The Gnome Files application is installed on Ubuntu. Although this application is not, a different application exists in the system to show files and directories. Let's find file.

When the Files application is opened, the directory to be searched is selected from the left menu. At the top, the word/character for the file to be searched is entered and the search icon is clicked.

How to find files in Ubuntu? [SOLVED]

To include hidden files in the search, "Show Hidden Files" is opened as described in the image below.

How to find files in Ubuntu? [SOLVED]

To search under a different directory, click "Other Locations" and select the search directory.

How to find files in Ubuntu? [SOLVED]

Then the word/character is entered for the search. When the character starts to be entered, the search starts synchronously.

How to find files in Ubuntu? [SOLVED]

Information about the search and information about the file are displayed on the screen.


Method-2: Find Files Using Catfish

The Catfish application is used to search with a graphical interface. For installation the following command should be run in terminal:

foc@ubuntu22desktop:~$ sudo apt install catfish -y

After installation, the application opens from the menu. It has file type, modify time and hidden file search features. Enter the file name to be searched and press enter.

find files

You can see the found files on the screen.


Method-3: Find Files Using find command

Find is the most used application to search for files on the command line. Its usage is as follows:

Usage: find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression]

Let's show a few examples:

Example-1: To find the files with the name passwd under the /etc directory, the following find command should be written:

foc@ubuntu22desktop:~$ sudo find /etc -name passwd 

Example-2: To find files larger than 30k in the /boot directory:

foc@ubuntu22desktop:~$ sudo find /boot -size 30k

Example-3: To find passwd files with file type under the / directory:

foc@ubuntu22desktop:~$ sudo find / -type f -name passwd

Example-4: To find files with the word "bash" in their filename in your current directory:

foc@ubuntu22desktop:~$ find . -name \*bash\*


Method-4: Find Files Using locate command

Another application you can use to search for files on Ubuntu is locate. If it is not installed, install it with the following command:

foc@ubuntu22desktop:~$ sudo apt install locate -y

Its standard usage is as follows:

Usage: plocate [OPTION]... PATTERN...

Example-1: To find "passwd" files under the /etc/ directory:

foc@ubuntu22desktop:~$ locate /etc/ passwd

Example-2: To find files containing the word bash on the system:

foc@ubuntu22desktop:~$ locate -i  *bash

The locate command uses a database. This database needs to be updated regularly. Run the following command in terminal to update the database:

foc@ubuntu22desktop:~$ sudo updatedb

Database(s) are under the following directory:

foc@ubuntu22desktop:~$ ls /var/lib/plocate/
CACHEDIR.TAG  plocate.db

To use a different database, enter the -d parameter:

foc@ubuntu22desktop:~$ plocate bashrc -d /var/lib/plocate/plocate.db


Method-5: Find files using grep command

grep is actually used to search for text within files. However, it lists the files in which the searched word occurs. In this respect, it is a file search command.

The standard usage is:

Usage: grep [OPTION]... PATTERNS [FILE]...

Example-1: To find files that contain bashrc in your current directory:

foc@ubuntu22desktop:~$ grep -ri "bashrc" . 
.profile:    # include .bashrc if it exists
.profile:    if [ -f "$HOME/.bashrc" ]; then
.profile:	. "$HOME/.bashrc"
.bashrc:# ~/.bashrc: executed by bash(1) for non-login shells.
.bashrc:# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
.bashrc:# sources /etc/bash.bashrc).

Example-2: To find out which lines the bashrc statement is in in the found files, the -n parameter is entered:

foc@ubuntu22desktop:~$ grep -ri "bashrc" -n
.profile:13:    # include .bashrc if it exists
.profile:14:    if [ -f "$HOME/.bashrc" ]; then
.profile:15:	. "$HOME/.bashrc"

Example-3: List only the filenames of files that contain bashrc:

foc@ubuntu22desktop:~$ grep -ri "bashrc" -l


Method-6: Find files using ACK command

Although it is not very well known, there is another command you will use in Ubuntu. Install the ACK to the system:

foc@ubuntu22desktop:~$ sudo apt install ack -y

The standard usage is:


Example-1: Files containing the word bashrc in the directory you are in are displayed together with the line numbers of the file contents:

foc@ubuntu22desktop:~$ ack bashrc
13:    # include .bashrc if it exists
14:    if [ -f "$HOME/.bashrc" ]; then
15:	. "$HOME/.bashrc"

1:# ~/.bashrc: executed by bash(1) for non-login shells.
109:# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
110:# sources /etc/bash.bashrc).

Example-2: Use the -l parameter to list only files that contain bashrc:

foc@ubuntu22desktop:~$ ack bashrc -l

Example-3: To find in subdirectories as well:

foc@ubuntu22desktop:~$ ack -r "bash" -l


What is NEXT?



In this article, we have shown different methods of finding files in Ubuntu. You may have heard of some recently. You may need more details, especially about console commands. You can use the following command to access local manual files:

foc@ubuntu22desktop:~$ man find

Instead of find, you can type the command you want to reach the manual pages.


References - How to find all files containing specific text (string) on Linux? - Find a file by name using command-line


Views: 6

Omer Cakmak

He is highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware. You can connect with him on LinkedIn or check his projects on GitHub page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to

Thank You for your support!!

Leave a Comment

We try to offer easy-to-follow guides and tips on various topics such as Linux, Cloud Computing, Programming Languages, Ethical Hacking and much more.

Programming Languages