Console Colorization
Introduction
Here we’ll see how to colorize certain elements in console terminals.
Man Pages
To make the output of the man command more readable by adding color, you can do the following which involves using the most command instead of less for man pages:
sudo apt-get install most
export PAGER=`which most`
(use the Alt Gr+7 characters to execute the command)
To permanently set the PAGER value:
sudo vi /etc/security/pam_env.conf
Then modify to have these lines:
#PAGER DEFAULT=less
PAGER DEFAULT=most
Log Files
I installed CCZE which allows me to better view Postfix logs:
apt-get install ccze
I’ll let you read the man page and visit the website for all the features… but I already like the very practical:
tail -f /var/log/mail.log | ccze
Alternatively, there’s also the possibility to save the colorized output as an HTML page… Just need to set up Apache :)
ccze -h < /var/log/mail.log > output.htm
Note that it doesn’t just colorize Postfix, but also fetchmail, exim, apache, procmail, proftpd, squid, vsftpd, syslog, and others.
Last updated 03 Oct 2006, 14:44 CEST.