LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-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, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
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



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 08:07 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
Open Source Consulting | Domain Registration