LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-30-2004, 04:39 PM   #1
Coldmiser
Member
 
Registered: Sep 2003
Location: Chicago
Distribution: Ubuntu
Posts: 36

Rep: Reputation: 15
ls -R {filename} How do I search for a single file?


Somethings I can do on Linux and still some simple stuff illudes me.
I can write a perl program, have it create an entry into a MySQL database and then have the same perl file e-mail a confirmation back to the user, but I still cannot find a simple file on the server.

In Perl I am told that I need to edit my Mail::Sendmail.pm file with the smtp server or I am going to have to put my smtp server entry in every file. I would rather just edit my Sendmail.pm file.

Only problem is, I can't find the darn thing. I've tried 'ls -R Sendmail.pm' but apparently that is not the correct way to use ls

MY REAL PROBLEM (enough venting now) : If someone could just PLEASE answer a simple question of how to do a recursive file find. Something similar to a dos 'dir/s filename.txt'

Thank you in advance for answering probably the stupidest question of the day. I already feel like a DOLT for having to resort to asking.
 
Old 04-30-2004, 04:40 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
If you have slocate installed:
locate Sendmail.pm

Otherwise:
find / -name Sendmail.pm
 
Old 04-30-2004, 06:31 PM   #3
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
maybe use grep with ls also?
 
Old 04-30-2004, 11:38 PM   #4
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 83
I suppose if you want to use grep you could, but david_ross' answer solves the problem. To expand on his answer to make it a little more generic, you could run either:

slocate <search-string>

--or--

find <path> -name <search-string>

where <search-string> is what you're interested in finding and <path> is the directory from which you want to start searching. (Note that you shouldn't use wildcards in the search-string with slocate, but that you could/should use wildcards with find. Personally I think slocate is the way to go, assuming you've got it.) Lastly, if you use "find" as a regular user and you start searching from the top root directory, you are likely to get a lot of permission errors as a result of attempting to access directories that are off-limits. -- J.W.
 
Old 05-01-2004, 06:18 AM   #5
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
i never did like slocate, it requires to keep a database of my files, and i see that as a security risk (ok, more like I'm a lazy kid that don't want a stupid database of files because the FS is the database of files ..... and also i don't like running meaningless processes, find and ls work *slower no doubt* and better in my opinion)
 
Old 05-01-2004, 08:45 AM   #6
|2ainman
Member
 
Registered: Mar 2004
Distribution: Slackware current, DSL 0.9.2
Posts: 133

Rep: Reputation: 15
find <path> -name <pattern> -print 2>/dev/null
much better
 
Old 05-01-2004, 10:06 AM   #7
grcunningham
Member
 
Registered: Apr 2004
Location: Florida
Distribution: RedHat 9.0/Afterstep
Posts: 103

Rep: Reputation: 15
if you decide to use slocate (in RedHat you can just use
locate), make sure you have run updatedb first
 
  


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
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 05:33 AM
emacs #filename# file question Guvvy Linux - Newbie 3 01-31-2005 07:26 PM
Find File broken, need search utility, where does WineX install, KDE file roller? Ohmn Mandriva 6 07-05-2004 11:34 PM
How to 'apt-cache search' & 'apt-file search' by distribution? davidas Debian 3 04-19-2004 02:56 PM
trying to search and replace text file for single & multiple line breaks separately brokenfeet Programming 7 08-29-2003 02:56 PM


All times are GMT -5. The time now is 08:44 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