How to search a word in all files in linux

This is very easy and can be done by using grep command .

> grep -R “word to search” * > log.txt

Well only grep -R “word to search” is enough .It will display the result in terminal. If you are using > sign , then it will be written in that log file.

About these ads
Explore posts in the same categories: linux

2 Comments on “How to search a word in all files in linux”

  1. Reddeppa Reddy Says:

    Thanks for your quick and accurate info here…

    Thanks
    Reddy

  2. Math Says:

    grep -lR “searchword” *

    This will list the files, which has similar words, Thanks.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: