How to Install Locate on CentOS Server

Atlantic.Net NOC
by Atlantic.Net (68posts) under Cloud Hosting
0 Comments
Verified and Tested 02/25/2015

Introduction

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. 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.

Prerequisites

A server running CentOS. If you do not have a server and need one, Atlantic.Net offers reliable cloud hosting options.

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:

updatedb

The cronjob will update the database daily, but if you are ever installing a lot of files and need to search for them, you should use the updatedb command again. Now, you are able to 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.


Related Posts


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies in our updated Privacy Policy. If you continue to use this site, you consent to our use of cookies and our Privacy Policy.