facebook youtube pinterest twitter reddit whatsapp instagram

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

Output

james@server:~$ locate notes
/home/james/mynotes
/home/james/notes
/home/james/mynotes/notes.txt
/usr/lib/git-core/git-notes
/usr/lib/python3/dist-packages/twisted/internet/iocpreactor/notes.txt
/usr/share/doc/git/contrib/examples/git-notes.sh
/usr/share/doc/initramfs-tools-core/maintainer-notes.html
/usr/share/man/man1/git-notes.1.gz


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.

Related Post(s)

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text-based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • How To Send Mail To Multiple Addresses Using (mailx)

    In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail. I assume you already have mailx command, i

  • Monitoring Multiple Log Files In RealTime With MultiTail (Ubuntu)

    Oh my... I really find scanning through the logs file time consuming, and painful. Luckily for me, I founded Multitail, which is an awesome, and powerful tool for not only browsing through several f

  • Test Your Internet Download Speed from Terminal Using (Fast)

    Fast is a tiny utility program for testing your internet download speed from the terminal, to get started, you simply install via the snap store (Ubuntu): sudo snap install fast If you don't have sna

  • Access A Web Page In GNU/Linux Using (Links) [Web Browser in Text Mode]

    Links is a text-mode World Wide Web (WWW) browses that can be used to view a web page either via a local (file://) or remote ((http:// or ftp://) URLs. To get started with Links, install it using the