LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-13-2007, 10:58 PM   #1
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Rep: Reputation: 15
Searching


How do I search for specific files/directories via cmd line?
 
Old 06-13-2007, 11:11 PM   #2
vtel57
Member
 
Registered: Jul 2006
Location: Tampa, FL, USA
Distribution: Slackware64
Posts: 912

Rep: Reputation: 103Reputation: 103
Use the commands find, locate, or slocate. Check the man pages to see how these commands work:

Code:
$ man find (locate or slocate)
 
Old 06-13-2007, 11:20 PM   #3
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Original Poster
Rep: Reputation: 15
Thanks for the quick reply.........I have "$man locate" and I am still having a little trouble understanding it. When I run "$locate httpd.conf" from the root diredtory I get:

jeff@ubuntu:/$ locate httpd.conf
locate: fatal error: Could not find user database '/var/lib/slocate/slocate.db': No such file or directory

When I run the "$find httpd.conf", this command only finds the file for me if I am alrady in the directory which contains httpd.conf. Is there any type of switch that I need to use?

Thanks
 
Old 06-13-2007, 11:27 PM   #4
vtel57
Member
 
Registered: Jul 2006
Location: Tampa, FL, USA
Distribution: Slackware64
Posts: 912

Rep: Reputation: 103Reputation: 103
Before running locate, run this command as root:

Code:
# updatedb
Sorry, I should have mentioned that above.
 
Old 06-13-2007, 11:28 PM   #5
davimint
Member
 
Registered: Jan 2006
Distribution: Slackware Current
Posts: 272

Rep: Reputation: 33
As root run the command
Code:
bash-3.1# slocate -u
This will build the database for locate so you can use it but I prefer to use "find".

Here's an example of how to use the find command to find your file.
Code:
bash-3.1# find / -iname "httpd.conf"
The man pages will help you understand this better but I like examples.
 
  


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
Searching ckoniecny LQ Suggestions & Feedback 1 03-09-2006 10:24 PM
searching better Furlinastis General 2 03-04-2006 03:22 AM
Searching ??? ilnli Linux - General 5 01-03-2005 05:27 AM
I have been searching but.... Jacksenflamed Linux - Newbie 6 03-17-2004 09:26 PM
Searching mjgeiger Linux - Newbie 4 06-05-2002 08:26 PM


All times are GMT -5. The time now is 04:07 PM.

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