When reviewing a UNIX log file, I often feel like I’m looking for a needle in a haystack. Even after I ‘grep’ out what I’m looking for I still can’t find it. I also like to use the ‘tail –f’ command to watch a rolling log, but again the information scrolls too fast and you just can’t find what you’re looking for in the quick moving results. To find the interesting information we will obviously use the ‘grep’ command, but to identify the results in the information there are a couple of methods.
The ‘grep’ command will support ANSI colorization and this can be done a number of ways. The first way is to specify the –color or –colour option on the command line. The second way is to export a variable that ‘grep’ looks at when executed. You will most likey want to add the export lines to your .profile or .bashrc file.
(more…)