til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Add colour to grep

It can be quite useful to add colour to your output from grep, since it helps is identifying matches and hence makes sure you do not overlook something.

Basic example:

$ grep --color <pattern> <file>

Default colour is red, but can be changes using the environment variable GREP_COLOR:

An example:

$ GREP_COLOR='1;36' grep --color <pattern> <file>

I have only used two parameters in the above example, You can in addition set the background colour, please see the listed source for more details.

References