Verified and Tested 02/25/2015


This how-to will show you how to install locate on a CentOS server. This command is often the easiest and fastest way to find the location of files and directories, and this is very useful when you’re working on a Linux system for which you are not well acquainted. When you install mlocate, it will install the two commands: locate and updatedb. It will also install a cron job that updates the database daily.

Installing Locate on CentOS a Cloud Server

The command to install locate on a CentOS is:

yum install mlocate

You are not able to locate anything yet until you have updated the database for locate. Run the below command to do this:


The cronjob will update the database daily, but if you are installing many files and need to search for them, you should use the updatedb command again. Now, you can search for locations of files and directories.

For example, if you forget the location of ifcfg-eth0 you would run the command:

locate ifcfg-eth0

Sample locate command

Sample locate command

Congratulations! You may be interested in using the “find” command; alternatively, check out Linux Find Command. Check back for new updates.