Say I want to find all files that mention "Jonathan Appleseed" in a Linux system.
I see examples using grep, but I can't quite grep yet how to search (all directories from HERE). So I want to look in everything below /var/, for example
haha. It will take hours :> in any case .... grep -RE 'Jonathan Appleseed'
R is for recursive, and E for case sensitive
If your grep doesn't have the -R option,
find /var -type f -print | xargs egrep 'Jonathan Appleseed'
will generally do what you're asking.
I want to find all files that mention "Jonathan Appleseed" in a Linux system.
You're looking for:
grep -l -r "Jonathan Appleseed" /
If you want to run a command on all matching files, I would suggest:
grep -l -z -r "Jonathan Appleseed" / | xargs -0 <your command here>
Note that -l means show only the filename (not matching text), -r means recursive, and -z (if you choose to use it) means the file names are null ("\0") terminated rather than terminated with a carriage return. This means xargs can handle filenames with spaces, tabs, and carriage returns in the name more readily.
I also am passing / to indicate that grep should start at the root of the filesystem ("all files... in a Linux system.")