Friday, May 8, 2009

locate and updatedb on CentOS

If you have a CentOS 5.x box and locate doesn't work. Try this:

sudo yum install mlocate
sudo /etc/cron.daily/mlocate.cron

The first line will install the locate and updatedb commands. It will also setup a cron job to re-index your disk once a day. The second line runs that cron job immediately, so you can start using the locate command right away.

Now you can easily find files on your system. Just use the locate command.

$ locate mlocate.cron
/etc/cron.daily/mlocate.cron
$ locate updatedb
/etc/updatedb.conf
/usr/bin/updatedb
/usr/share/man/man5/updatedb.conf.5.gz
/usr/share/man/man8/updatedb.8.gz


Thanks to my friend Peter Stephan for educating me on the locate command. I don't know how I got along without it.

Enjoy!

7 comments:

Anonymous said...

Thanks for posting this! You saved my life today :-)

Anonymous said...

i need an hacker who can help me to do some jobs and i will pay him? you can mail me on smithrobison@yahoo.com

John Szaszvari said...

Thanks, I think centos is the only distro i have come across without this included.

This was a great help.

Anonymous said...

Thanks for the post, just what I was looking for.

Anonymous said...

thanks

Unknown said...

Thank you very much for this!
You saved my time a lot !!!

Anonymous said...

Thanks. Just what I was looking for...

Post a Comment