LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Need folder search command..... (https://www.linuxquestions.org/questions/linux-software-2/need-folder-search-command-506478/)

chillyroll 12-01-2006 04:46 AM

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.

David the H. 12-01-2006 05:16 AM

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.

matthewg42 12-01-2006 06:03 AM

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.


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