Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from serverfault.com Sep 21 '11 at 11:03

This question came from our site for system and network administrators.

Please do some research before posting. –  Praveen Sripati Sep 21 '11 at 11:54

4 Answers 4


grep -lir "helo" /path/to/dir
share|improve this answer

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

share|improve this answer
That's a lot of typing when you can just grep -r –  Matt H Sep 21 '11 at 12:05
With the Command find you can grep recursive through directories and grep in all files. –  kockiren Sep 22 '11 at 7:28

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

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.