How can I find a file by its content on Linux?

How can I find a file by its content on Linux in the command line?

For example, I want to find a file containing the word "helo" on my computer.


Solution 1:

Use:

grep -lir "helo" /path/to/dir

Solution 2:

You can create a file named grepall in /usr/local/bin/ with following content:

find -type f -exec grep -q $1 {} \; -print

then you can search for content by use grepall something

Solution 3:

egrep -R "hello" /path/to/dir

Solution 4:

Evil way: grep "something" */*/*