LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-01-2006, 04:46 AM   #1
chillyroll
LQ Newbie
 
Registered: Oct 2006
Posts: 25

Rep: Reputation: 15
Need folder search command.....


Hello guys,

I want to search for a particular file in entire system. When I run find or locate command, it searches only in current folder. When I did a search from root folder, it did the same thing. I THINK its skipping inner folders during search.

So can anyone suggest me how do I search for specific file or folder in entire system and not in specific folder.

Thanks in advance.
 
Old 12-01-2006, 05:16 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, locate at least doesn't work the way you describe. It doesn't do direct searches. You first create a database catalog of your entire system using the updatedb command (usually run on a regular basis using cron), and the locate command searches that. That's what makes it more convenient to use than find in most instances, since it can come up with results much more quickly.

I'd say that if locate isn't coming up with your file, then either you haven't run updatedb in a long time, or it just doesn't exist as that search term.

And as for find, if you start the search from /, then it should definitely be searching the whole system. Heck, you can watch the output in the terminal as it's searching so it should be obvious whether it's working or not. Again, if it's not coming up with a match, it probably just doesn't exist.

Last edited by David the H.; 12-01-2006 at 05:18 AM.
 
Old 12-01-2006, 06:03 AM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Chillyroll, are you talking about searching for a file with a particular name, or inthe contents of the file too? Locate only searches the names of files. Also, be aware that the search is case sensitive unless you use the -i option, e.g. You have a file called /home/bobdobbs/SomethingSweet. This command will not find it:
Code:
locate something
But these command will find it:
Code:
locate Sweet
locate -i something
...so long as updatedb has been run since the file was created.
 
  


Reply



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
search command? IonMarais Linux - Newbie 7 10-13-2006 06:59 AM
How to search a file/folder in filesystem natasha Linux - Newbie 4 07-18-2006 12:47 PM
command to search ekdya Linux - Newbie 3 11-12-2005 09:46 AM
Why Do I need to run updatedb each time I search for a file or folder? lennysokol Linux - Software 4 05-30-2005 10:49 PM
scan folder to search file os2 Programming 7 03-03-2005 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09: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
Open Source Consulting | Domain Registration