LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-18-2002, 04:46 AM   #1
NGraphiX
Member
 
Registered: Feb 2002
Location: Jerusalem, Israel
Distribution: Fedora Core 3
Posts: 154

Rep: Reputation: 30
really dumb shell question.. (slocate)


I know this is a dumb question but.

How do find a file named X?
if I use "locate X" I get all files beginning with string X
but what if I want to know where "sh" is ? locate would
find all files beginning with 'sh' but I'm only looking for one file!
apologies again for a such dumb question..
 
Old 09-18-2002, 05:20 AM   #2
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
Yeah, I remember when I faced the same issue. I dont thing there's an slocate option that would allow exact matches.

This is slow, but it works. But you knew this already.
find / -name sh -print 2>/dev/null > outfile
 
Old 09-18-2002, 08:09 AM   #3
NGraphiX
Member
 
Registered: Feb 2002
Location: Jerusalem, Israel
Distribution: Fedora Core 3
Posts: 154

Original Poster
Rep: Reputation: 30
bummer. 'find' is awfully slow .
 
Old 09-18-2002, 09:21 AM   #4
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
You could try limiting the scope of the search by specifying a target directory to search, ie binaries in /usr/bin. Also, by redirecting the output to a file, you won't see any results until the whole find is complete. If you are looking for just a few files, you'd probably be better off watching STDOUT. That way you can quit the find after the matches are made. Keep in mind that find won't quit after the first match so it's best to narrow the search directory as much as possible.
 
Old 09-18-2002, 09:42 AM   #5
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
familarize yourself with find http://www.linux-mag.com/2001-04/newbies_01.html
It is a great utility when you know how to invoke it.
 
Old 09-18-2002, 07:51 PM   #6
NGraphiX
Member
 
Registered: Feb 2002
Location: Jerusalem, Israel
Distribution: Fedora Core 3
Posts: 154

Original Poster
Rep: Reputation: 30
Good point/s.
A new "find" convert is on the way.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Got a question about slocate code neo_in_matrix Programming 3 03-28-2005 09:09 PM
Another Dumb Question ?? xedios Linux - Software 2 09-01-2004 07:03 PM
Quick slocate/updatedb question? King of Japan Linux - Newbie 4 08-29-2004 02:35 PM
dumb question! Athlon_Jedi Linux - Newbie 6 05-20-2003 01:51 PM
dumb question but anyways... 43w45r3e Linux - Distributions 2 01-26-2002 04:20 PM


All times are GMT -5. The time now is 11:11 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration