Pawan
Pawan

Reputation: 32321

Linux : Search for a particular word in all the files

I am using Ubuntu 12 . I am trying to search for the word "SymbolSetThree" in my Ubuntu Machine home directory .

For this i used

 grep "SymbolSetThree" /home

It simply displayed as grep: /home: Is a directory

Please let me know how to search for a particular word in all the files in Linux ??

This is what i tried

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

Upvotes: 5

Views: 40585

Answers (3)

MGP
MGP

Reputation: 3031

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

ack-grep -a "SymbolSetThree"

Upvotes: 2

Gilles Quénot
Gilles Quénot

Reputation: 184965

You are close, you just need the -r switch to have your command working properly.

 grep -r "SymbolSetThree" /home

will do the trick.

Upvotes: 6

NPE
NPE

Reputation: 500167

Use `find:

find /home -type f | xargs grep SymbolSetThree

The same result can be achieved by using the -exec argument to find (instead of xargs).

Upvotes: 3

Related Questions