LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 07-19-2006, 10:33 AM   #1
saeed
LQ Newbie
 
Registered: Jun 2003
Location: KSA
Distribution: Red Hat
Posts: 15

Rep: Reputation: 0
Question How to find those files having specific string???


Hello All and Greetings!!!

I know i can find a specific file using locate command.
Can anybody tell me the command how can i find those files having specific string inside in a specific folder.

Here i am talking about multiple files in a specific directory.

E;g
I want to find those files which contain a string let say "hello world" in /home?
Please could any1 write the command for it?

I'll be highly thankful

Saeed
 
Old 07-19-2006, 10:39 AM   #2
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
http://www.linuxquestions.org/linux/...uick_find_Tips
 
Old 07-19-2006, 10:43 AM   #3
lockpicker
Member
 
Registered: Feb 2006
Location: Sikkim Manipal Institute of Technology, Sikkim
Distribution: Slackware 10.2
Posts: 80

Rep: Reputation: 15
you could try using grep directly; do a man grep and that should give you enough info; as far as the locate is concerned, you have to update your slocate database before using that command, use updatedb command for updating the database(it'll take some time depending on the HDD size) and then locate <filename> should do it!
 
Old 07-19-2006, 11:30 AM   #4
saeed
LQ Newbie
 
Registered: Jun 2003
Location: KSA
Distribution: Red Hat
Posts: 15

Original Poster
Rep: Reputation: 0
Ehhhh
I am very poor in RND.. :$

Could you plz write down the full command
 
Old 07-19-2006, 12:50 PM   #5
lockpicker
Member
 
Registered: Feb 2006
Location: Sikkim Manipal Institute of Technology, Sikkim
Distribution: Slackware 10.2
Posts: 80

Rep: Reputation: 15
go to /home
grep -r "string goes here" . ( Dont miss the last '.' otherwise grep might consider talking to the stdin)

My advice: start RND!!
 
  


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
How to find files containing specific text? SurfTurtle Linux - Newbie 7 01-05-2008 06:57 AM
du on specific files from find command (use xargs?) fireman949 Linux - Software 2 07-10-2005 02:42 AM
how to find a specific file over several *.tgz files eeyoree Slackware 6 08-09-2004 01:37 AM
Find files, directories that are own by specific user mikeshn Linux - General 2 02-12-2004 04:52 PM
Find string pattern in directory of text files magnum818 Linux - Newbie 2 10-15-2003 09:19 PM


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