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
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.")
haha. It will take hours :> in any case ....
grep -RE 'Jonathan Appleseed'
R is for recursive, and E for case sensitiveIf your grep doesn't have the -R option,
will generally do what you're asking.
You're looking for:
If you want to run a command on all matching files, I would suggest:
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.")