Hrnsvnc Blog

Software, Technology and stuff


How to grep with colored output

In this short post i will show you an easy way to grep something and highlight the output in a color.

The only thing you have to do is to put the option “–color” after your grep command.
And thats it.

<somecommand> |grep --color

Now you can change the color whenever you use grep, you always get a colored output. To archive that use this command :

export GREP_OPTIONS='--color=auto'

You now also can change the color of your grep output. You only have to set the GREP_COLOR environment variable different value.For further reading i recommend the MAN page:

Please follow and like us:
Tweet 20

Leave a Reply

Your email address will not be published. Required fields are marked *