Unix command to search for text string in all files

bash, find, grep, macos, unix

Solution

Maybe this one?

sudo cd / && grep -rn "hello" *

EDIT: the 'n' option of course is not needed - it simply displays the line numbers and I find it nice. The 'r' option tells grep to perform recursive search within directories.

Problem

How do I get unix to search inside ALL files for a the string "hello"? I've tried the following but it doesn't work: ``` sudo grep "hello" | find / -name "*" 2>/dev/null ``` Does anyone have any other ideas? Thank you.

Original source