LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-09-2006, 01:55 PM   #1
RMSe17
Member
 
Registered: Jul 2004
Posts: 31

Rep: Reputation: 15
How do I search every file on the hard drive?


Hi!
I am trying to find a file on my hard drive that has the word tsunami in it. I think it should be very easy, but I am missing something... I tried going to root mount, and did this: ls -R | cat tsunami

but nothing happens... I know it will take couple seconds for you to answer

Thanks,
RMSe17
 
Old 02-09-2006, 02:13 PM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
try 'find / -name *tsunami* -print' as root
 
Old 02-09-2006, 02:14 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL
Distribution: Funtoo
Posts: 6,926

Rep: Reputation: 128Reputation: 128
This command:
find / -iname '*tsunami*' 2>/dev/null
or
locate tsunami
which isn't quite as efficient, but quicker
 
Old 02-09-2006, 02:26 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by RMSe17
Hi!
I am trying to find a file on my hard drive that has the word tsunami in it. I think it should be very easy, but I am missing something... I tried going to root mount, and did this: ls -R | cat tsunami

but nothing happens... I know it will take couple seconds for you to answer :)

Thanks,
RMSe17
When you say "has the word tsunami in it", do you mean it has
the word tsunami in its name, or the file contains the word
tsunami?

If it's the latter try something like
Code:
find / \( -path /dev -prune -a -path /proc -prune \) -o -exec grep -li "tsunami" {} \;

Cheers,
Tink
 
Old 02-09-2006, 02:33 PM   #5
RMSe17
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Oups, sorry, wasnt clear enough, I am looking to get the name(s) of file(s) that contain the word tsunami inside the file, in contents.

Thanks! Trying solution.
 
Old 02-09-2006, 04:02 PM   #6
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
find / -type f -exec grep -Hin tsunami {} \; 2>/dev/null

It will give you the path to the file and what line number.
 
Old 02-09-2006, 06:58 PM   #7
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL
Distribution: Funtoo
Posts: 6,926

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by Electro
find / -type f -exec grep -Hin tsunami {} \; 2>/dev/null

It will give you the path to the file and what line number.
Really nice work there.
 
  


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
Hard drive file system problem, I think...please HELP QUICKLY rivalmist Fedora 7 01-23-2009 08:26 AM
Reiser file system / Hard Disk/ Hard Drive Problems Oxyacetylene Linux - Software 4 10-10-2005 02:24 PM
Hard Drive for File Swapping PlantPerson Linux - Newbie 2 07-28-2004 07:07 PM
External Hard Drive Device File?/?? indrid Linux - Hardware 2 03-16-2004 02:13 PM
hard drive search badgers Linux - Newbie 4 10-06-2003 03:14 PM

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

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