Linux Tip #8: grep with color

grep-with-color-1

If you’re running grep on a large file with multipled results, highlighting your results would really easy on your eyes.

Here’s how;

Export the “GREP_OPTIONS” environment variable to include “–color=auto”. Run the export command below.

export GREP_OPTIONS='--color=auto'

Once you’ve executed the command, run a simple grep to see the highlights in action.

Red is the default highlight color. I’ll cover setting custom colors in a future post.

Leave a Reply

© 2008-2009 The Danesh Project
Powered by Wordpress and made by Guerrilla. Best viewed in Mozilla Firefox