Easy coloured tail output

As part of my job I’m often watching the output of a tail -f <filename> command run down my terminal window… and on my development and quite testing machines this is all well and good.

But what if the system is a pretty busy one? Well here it can be hard to spot the messages that might be of interest to you. And that is why I use a little trick to highlight a specific word in the output.

How to highlight words in tail output?

1) Basically add the following lines to your .bashrc  file

This adds a function available to you in bash that can be then be used to do exactly what you want. Say for example you want to highlight all instances of Error when tailing a file called foo.txt you can run the following.