Linux: search for a specific word in all files

I am using Ubuntu 12. I am trying to find the word "SymbolSetThree" in my Ubuntu machine home directory.

For this I used

 grep "SymbolSetThree" /home

      

It just shows up as grep: / home: there is a directory

Please let me know how to search for a specific word in all files in Linux.

This is what I have tried

sai@sai-Aspire-4720Z:/$  grep "SymbolSetThree" /home
grep: /home: Is a directory

      

+3


source to share


3 answers


You are close, you just need a switch -r

to get your team to work properly.

 grep -r "SymbolSetThree" /home

      



will do the trick.

+4


source


Use `find:

find /home -type f | xargs grep SymbolSetThree

      



The same result can be achieved using the argument -exec

for find

(instead of xargs

).

+3


source


For tasks like this I really like ack-grep, is programmer oriented (source files only, .py.rb.c.sh) but with -a it searches all file types.

ack-grep -a "SymbolSetThree"

      

+1


source







All Articles