Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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?
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
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.