0

i am unable to locate files or directories while executing below commands. getting below error:

$ locate httpd
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
3
  • For Centos it should be "updatedb" command. Run it then you must wait for a while for the command to finish it's work. Also check your cronjob daily tasks if updatedb is there.
    – risyasin
    Commented Apr 28, 2015 at 14:07
  • Run updatedb command, no changes made. Commented Apr 29, 2015 at 10:50
  • Well you have always alternatives in Linux. you can try "find" command. linux.die.net/man/1/find .. Eg: find httpd -path / -print
    – risyasin
    Commented Apr 29, 2015 at 11:15

2 Answers 2

0

You need to create your locate database. This is usually a regular cron job. Different distros will have different tools. In FreeBSD it's /etc/periodic/weekly/310.locate

0

You probably just installed the mlocate package and the database wasn't created/updated just yet. The package creates a cronjob at /etc/cron.daily/mlocate.cron that runs daily, but if you don't want to wait, you can just run updatedb first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .