How To Find Files Using Locate in Ubuntu

It’s kind of frustrating when you are searching for a particular file, and you have no idea of how to find it, In this guide, I’ll walk you through on two different ways you can find a file in your GNU/Linux server.

Using the Locate

Locate is an awesome utility useful for finding files, to get started with the locate, install it as follows:

sudo apt install locate

Before we start using locate, it is advisable you update the mlocate.db database before first use:

sudo updatedb

mlocate.db is used by locate to store the search indexes. It might take a while for the updates to go through, probably few seconds.

Let’s say you are finding a file named notes, but don’t know the exact one you are looking for, you can use locate to find all the matching file with name ‘notes’ for example:

locate notes


james@server:~$ locate notes

As you can see above, it beautifully returns all the matching files that includes the word ‘notes’.

Keep in mind that, you need to know the name of the files you are searching for, and it is also case sensitive,the word Notes is different from notes when using the locate command, enjoy.

Comment policy: Respectful and beneficial comments are welcome with full open hands. However, all comments are manually moderated and those that doesn't relate with what the passage is saying or offensive comments would be deleted. Thanks for understanding!

Leave a Reply

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