How to search for a string throughout the whole system?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Should work. You have to specify that it needs to recurse through all directories. But if you want to avoid some nastiness that may happen with devices, then using an extension of jim's find command would help:
Code:
find / -type f -exec grep "XXXXXX" {} \;
At least, I think that'll avoid trying to grep devices...
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
and that'll keep it from searching /proc too, which is good, unless you're cracking.
grepping a FIFO (like /dev/mouse) can take a while. as long as you're willing to wait actually. that's why you don't want to grep devices. if you want to search empty file space for text, you may actually want to grep a device, like the hard drive, or a floppy.
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
Well...it actually didn't keep it from /proc or other binary files. I let it run for a while, and then all of a sudden my DNS got screwed up?!?!! I couldn't resolve any names anymore?!??! I don't know what happend, I just know the last message I saw on screen was something like...
.
.
.
Binary file /proc/XXX
.
.
.
and that was the end of my system. I rebooted and everything worked again, but it was scary!
Anyways, I ran it again, but not from / but to /usr/local/joe and it found the string and it returned it on screen, but it didn't say in which file? So it basically spat back what I put in the search string.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
i had more than that on here, but i recently archived and repartitioned a bunch of stuff to make some free space. i just dumped netbsd, freebsd, and openbsd. i used to have more than 50 OS's spread over 2 drives, but after a bunch of other people started doing it, so it wasn't a big deal anymore, i cut back.
i had to keep stuff written down on a pad to keep track of what was where.
even back in 1992 i had 2 versions of dos and linux on a 40 meg hard drive.
all i could do in linux was ls, cat, and textris, and i couldn't get out of vi if started it, if i remember correctly.
there is a multiple linux for development howto that shows how to put many copies
of linux on 1 partition, and after i started doing that, i didn't need all the partitions.
The multiple bsd's was the hardest thing. and solaris screwed up my partition table, but i fixed it, and solaris would still boot.
i really only use redhat 6.2. well, it used to be redhat 6.2. the only thing it has in common with redhat 6.2 is that the login screen says it is. anyway, it was just a little bragging.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.