LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-20-2005, 01:10 PM   #1
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Rep: Reputation: 30
grep throughout the whole file system....?


Hi'all,

I'm trying to find a config setting, but I can't remember where I put it.....(duh, I know). I remember the setting's name, but not where the file's at....

Can someone tell how I can grep through the whole system....


Thanks!
 
Old 03-20-2005, 01:13 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
It will probably take a while but:
grep -r "your string" /

If the file's name is "something.conf" then this should be quicker:
find / -name "*.conf" -exec grep -l "your string" \;
 
Old 03-20-2005, 01:18 PM   #3
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Original Poster
Rep: Reputation: 30
OK, cool!

Is there a way to keep grep from going into some dirs like /dev or /proc for example?
 
Old 03-20-2005, 01:23 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
The easiest way is probably just to specify the directories you do want:
grep -r "your string" /etc /root /home /usr/local

You could also do it using find but if you don't want to limit it to a specific file type then just using grep is probably best.
 
Old 03-20-2005, 01:30 PM   #5
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Original Poster
Rep: Reputation: 30
Yup, indeed!

Thanks Dave!
 
  


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
can't grep in the RH system ust Linux - Software 5 05-24-2005 07:27 AM
Using grep, etc to modify a text file dangerousdave Linux - Newbie 7 02-23-2005 02:49 PM
Grep pattern first line of a file ericcarlson Linux - Newbie 11 07-20-2004 10:51 AM
grep a line in a file from dir bkeating Linux - Newbie 4 07-24-2003 02:04 AM
grep file in the subdirectory juno Linux - General 3 09-30-2002 11:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:15 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