locate : command not found
Hi,
locate, whereis commands are not working on my centos box. When ever i give locate file_name the out put is locate:command not found. After this i tried to install it by giving yum install locate the output is Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Nothing to do Please help me in this issue. Please also tell me how can we find rpm package for a command, so that when ever it says that this command not found i can directly install the package so that it works. Thanks, Prakash. |
I'm on a redhat derivative now, and in mine the package is called slocate, not locate. Try yum install slocate and see if that helps.
I'm not too sure on this next bit, but I think yum search locate will search through the repos and give you all the package names where the text 'locate' is found. Or maybe its yum list locate. |
Hi,
Thanks for your concern but it did not work. The output is the same as earlier saying that nothing to do. Prakash. |
Google is your friend.
The package is now called mlocate apparently. Did you try the yum search command? |
If you made sure you yum repos are configured OK, then try 'yum -y install mlocate'. And please fill in at least your distro+release info in your profile.
|
hi,
Sorry to say that there is no difference after using yum install mlocate and yum -y install mlocate the output is the same as earlier. Will be there any RPMs for these so that we can directly download those and use Thanks, Prakash. |
The package name is either "slocate" (old) "mlocate" (new). You can find it by browsing the repo (mirror) or through Pbone, Rpmfind or your favourite searchengine. What repos are configured in /etc/yum.repo.d/ for your machine and what CentOS version are you using?
|
run the command
rpm -qa|grep -i locate this will tell you whether locate or slocate RPM is installed in your machine. I believe it's not installed and in that case try installing the package either from web or from the media from where you have installed your OS. Check out this site....most probably you will get the package you are searching for http://rpm.pbone.net/index.php3/stat...om/CentOS.html Cheers sir_com |
ohh!!! forgot to mention....once you download the RPM successfully on your local machine...install it using
rpm -ivh <rpm-name> --nodeps |
Hi,
I am using centos 5.2 I think you can find the error now. Now when i use locate command the output is locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory thanks, Prakash. |
By default that database is updated daily from a cronjob in /etc/cron.daily. Locate (heh) the cronjob, then issue the command manually.
|
You've now got locate installed, but you haven't built a database. You need 'updatedb' to do this (probably need to be root to do it).
Just for your further information, you could be more helpful when you are saying that something doesn't work. For example, you could include whether there was any output when you ran the rpm commands and not just what happened when you tried to run the final command itself. |
Hi,
Thanks for your help. It works after running the code in /etc/cron.daily/ Is this the same in case of whereis command also? But there is no file related to whereis in /etc/cron.daily Please help me to resolve this also. Thanks, Prakash. |
No, 'whereis' doesn't use a database like 'locate' or 'whatis' slash 'apropos'. I think it would be good for you to read Rute and the CentOS Deployment docs (the Deployment_Guide-en-US-5.2-11.el5 package contents). Much basic info there.
|
Summary of explanations here
Some of the hints are better and some are not, so here is a summary about locate:
- The command name is still "locate" - But when you install it, you need to install it with "yum install mlocate" command - After that either wait for tomorrow :-) or give command "updatedb". This collects folder and file names to a database, which is the reason everyone wants to use locate instead of find: it is dozens of times faster. And no need to do: - Check your cronjobs - you will just find the updatedb command from there. - Do RPM installation - if you use yum, then it will do the installation always as well |
All times are GMT -5. The time now is 01:14 AM. |