Linux Tutorial Series

Linux Tutorial Series – 71 – The locate command

Here is the video version, if you prefer it:

Today we are going to talk about locating files. This is very useful and I use it relatively frequently myself.

The locate command is used to locate files. (Shotts, 2019)⁠ It is used as such:

locate string

where string is a part of the pathname you want to locate. To remind ourselves, a pathname is a location on your disk, such as /home/mislav/Linux_folder, so you are asking your computer “give me all the pathnames that contain string within themselves” (string being an array of characters).

Here is an example:

mislav@mislavovo-racunalo:~/Linux_folder$ locate Linux_folder















Here, all paths that contain Linux_folder within them are located.

Note: You may not have locate installed as a command (I know I haven’t). You can install the locate command by following an answer provided here: (“How to install the locate command?,” n.d.)⁠

locate uses a database to find files. What that means is that pathnames are stored in a database and then that database is searched for pathnames matching string.

There also exists a command called find, which you can also use to find files, but we will talk about find in another article.

Thank you for reading!


How to install the locate command? (n.d.). Retrieved February 6, 2020, from

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from Pages 241-243

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

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