locate: can not open `/var/lib/mlocate/mlocate.db’: No such file or directory

The locate command is a very useful command to find the exact path/location of files in Linux if you know the file name. You can install it using yum and the package is mlocate.
Quote

can not open `/var/lib/mlocate/mlocate.db’: No such file or directory

It is a common issue while using locate command, and the error is because we haven’t created the db for locate. To create db for locate, simply run the command :

Code: 
# updatedb

Wait for it to complete and run the locate command again. It should be working fine this time…!!!  :D
You can use the same command (updatedb)to update recent changes to locate’s db.

About Sarath

A Techie from Kochi, India with 8+ years of experience in Linux and Windows server administration. I learn new things almost everyday and I enjoy the fun of learning and sharing my knowledge.