Home > Uncategorized > Colorize tail outputs with this nifty alias

Colorize tail outputs with this nifty alias

Thanks to hacker news, I came across an article with some interesting “tricks” to do with the linux shell.

A very valuable trick is to colorize output that’s handled by grep, rather egrep.

alias grepc='egrep --color=always'

A usage example would be:

tail -f /var/log/messages | grepc -i 'Warning'

Remember your regex, ^ is start of line, $ is end of line. So append one or the other like ‘^|warning’ to show all the lines, and colorize the included string… append another string with another ‘^|warning|error’.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: