After reading a quote on a mailing list last week about the concept behind unix tools and their focus on doing one task well and the OS allowing you to pipe several commands in one go, it dawned on me that I could do the following on log files:
CODE:
tail -f /var/log/syslog | grep "named"
So as the log fills up only items where the pattern "named" is found are displayed. Very neat!
UPDATE
Thanks to some of the comments, here's a way to colour code the output (hopefully this will render better than the comment output)
CODE:
tail -f /var/log/syslog | grep "named" --color
June 29, 2007 at 2:55 am
Oh, I just found this through Google. It was exactly what I was looking for, but I never thought it’d be *this* simple. Heehee.
July 16, 2008 at 7:29 pm
Even better use “tail -f /var/log/logfile | grep pattern –color” to highlight the individual matched pattern
July 30, 2008 at 1:10 am
The colour coding ability is a great addition, thanks Liam!
July 29, 2009 at 4:01 pm
Nice man it’s what I looking for
,
June 21, 2011 at 12:47 pm
Exactly what I was looking for thank you!