LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 02-05-2003, 12:24 AM   #1
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
Unhappy How do I find a specific file?


I'm not all that new to linux, but this is one I just can't seem to figure out. I've the man pages (man -k find, locate) but I can't seem to find anything. Doesn't seem to be any place intuitive in Gnome. I just need to know where some files are located.

Help.

Richard
 
Old 02-05-2003, 12:31 AM   #2
aliensub
Member
 
Registered: Apr 2002
Location: Denmark
Distribution: OS X
Posts: 306

Rep: Reputation: 30
do

locate / file
where / is the dir you wan't to search in ( / means whole filesystem)

You can alsp use find for the same
 
Old 02-05-2003, 02:27 AM   #3
annehoog
Member
 
Registered: Jan 2002
Location: Nederland
Distribution: RH 8 Psyche and Debian Woody
Posts: 373

Rep: Reputation: 32
Mind you if you can't find anything and you're very sure it should be there, try updating the database of your searchtool.
(in case of locate do 'updatedb')
It happened to me that I couldn't find a thing even though I was sure I had just installed it.

Anne
 
Old 02-05-2003, 04:06 AM   #4
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 57
The way I do it is,

find | grep "whatever"

rather inefficient, but I'm too lazy to learn how to properly use find
 
Old 02-05-2003, 04:09 AM   #5
annehoog
Member
 
Registered: Jan 2002
Location: Nederland
Distribution: RH 8 Psyche and Debian Woody
Posts: 373

Rep: Reputation: 32
I have never been able to find anything using grep, I'll have to do some reading on that

Anne
 
Old 02-05-2003, 05:22 AM   #6
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
I usually use:
find ./ -name "filename"
If there are lots of entries (such as when filename is *.mp3), then piping to less or grepping to refine the search works well.
 
Old 02-05-2003, 06:52 AM   #7
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
find . -name filetosearchfor* -print
starts searching in the current directory through
all the subdirectories for the filenameyou specify.
I put the asterick in to show you can use wildcards.
its
find then where you want to start searching from
then what you want to search for
then what you want to do with the results.

locate uses a database that it makes and is much faster,
but may not be current. often locate updates its
database as a cron job in the background.

grep is for searching for text in a file or files
grep -r poo *
searches for poo all files in the current directory
and below.
you could go into your mozilla cache or cookies
and see if your credit card number was stored
anywhere there
grep -r 1234123412341234 *
 
  


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
How to find files containing specific text? SurfTurtle Linux - Newbie 7 01-05-2008 05:57 AM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 07:15 PM
Where to find specific older deb packages? elfoozo Debian 3 12-23-2004 06:16 PM
how to find a specific file over several *.tgz files eeyoree Slackware 6 08-09-2004 12:37 AM
Find files, directories that are own by specific user mikeshn Linux - General 2 02-12-2004 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:28 AM.

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