LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-24-2008, 01:50 AM   #1
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Rep: Reputation: 15
Thumbs up 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.
 
Old 07-24-2008, 04:25 AM   #2
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 39
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.
 
Old 07-24-2008, 05:39 AM   #3
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Original Poster
Rep: Reputation: 15
Hi,
Thanks for your concern but it did not work.
The output is the same as earlier saying that nothing to do.

Prakash.
 
Old 07-24-2008, 05:46 AM   #4
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 39
Google is your friend.
The package is now called mlocate apparently. Did you try the yum search command?
 
1 members found this post helpful.
Old 07-24-2008, 05:46 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
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.
 
Old 07-24-2008, 05:54 AM   #6
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Original Poster
Rep: Reputation: 15
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.
 
Old 07-24-2008, 06:04 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
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?
 
Old 07-24-2008, 06:15 AM   #8
sir_com
Member
 
Registered: Feb 2008
Posts: 31

Rep: Reputation: 15
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
 
Old 07-24-2008, 06:17 AM   #9
sir_com
Member
 
Registered: Feb 2008
Posts: 31

Rep: Reputation: 15
ohh!!! forgot to mention....once you download the RPM successfully on your local machine...install it using

rpm -ivh <rpm-name> --nodeps
 
Old 07-24-2008, 06:20 AM   #10
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Original Poster
Rep: Reputation: 15
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.
 
Old 07-24-2008, 06:43 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
By default that database is updated daily from a cronjob in /etc/cron.daily. Locate (heh) the cronjob, then issue the command manually.
 
Old 07-24-2008, 06:48 AM   #12
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,064

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
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.
 
Old 07-24-2008, 07:34 AM   #13
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Original Poster
Rep: Reputation: 15
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.
 
Old 07-25-2008, 06:25 AM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
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.
 
Old 07-16-2014, 01:53 AM   #15
TimoRiikonen
LQ Newbie
 
Registered: Jul 2014
Posts: 1

Rep: Reputation: Disabled
Thumbs up 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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cpan> locate -u Unknown shell command 'locate -u'. Type ? for help. sharad2005 Linux From Scratch 1 08-04-2006 12:40 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
copy all of one filetype found by locate command to a single directory socratesone Linux - Software 3 06-22-2005 01:23 PM
What command will locate a particular.. cbjhawks Linux - General 1 03-21-2004 08:07 AM
Updatedb and Locate - commands not found rodviking Linux - Software 3 11-17-2003 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration