LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 10-05-2009, 11:08 PM   #1
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 51
Blog Entries: 1

Rep: Reputation: 15
Unhappy locate: can not open


Running into a problem with the locate command. When I try to use the locate command: locate *.h
I get the following error message:
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory

I have a lot of include files in /usr/include
and I locate responds to whereis.

Does anyone know whats happening? Any help would be appreciated.

Ron
 
Old 10-05-2009, 11:18 PM   #2
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Try running the updatedb command as root.

If you're using ubuntu or any of its derivatives, type

sudo updatedb

Note: You need to run this command when you add new files and/or programs to your linux system. This step is optional. But it must be run the first time before using the locate command.

When the updatedb finished, try the locate again.

Tip: Add the -i option to locate for case insensitive search.

locate -i keyword

Last edited by dv502; 10-06-2009 at 01:08 PM.
 
Old 10-06-2009, 03:14 AM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by rcmonroig View Post
Running into a problem with the locate command. When I try to use the locate command: locate *.h
I get the following error message:
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory

I have a lot of include files in /usr/include
and I locate responds to whereis.

Does anyone know whats happening? Any help would be appreciated.

Ron
Try this:

# updatedb (as root) (if you have problems locating something you know exists)

Then:

$ locate "*.h"

Note the quotes -- this will prevent shell expansion of your argument, so "locate" sees it as you intended regardless of the content of the current directory.
 
  


Reply

Tags
locate


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
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory BallsOfSteel Linux - Newbie 4 12-11-2010 08:30 AM
cpan> locate -u Unknown shell command 'locate -u'. Type ? for help. sharad2005 Linux From Scratch 1 08-04-2006 12:40 AM
locate juanb Linux - Newbie 2 12-18-2003 05:36 AM
Can't locate locate hindenbergbaby Linux - Newbie 3 10-22-2003 04:13 PM
how to locate ? jamaso Linux - General 4 10-17-2002 03:45 PM


All times are GMT -5. The time now is 07:58 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration