I enjoy using UNIX/bash commands that support coloured output. Consequently, I have a few aliases defined which automatically enable coloured output of the commands that I know support this option. However, I'm sure there are hundreds of commands out there that support coloured output - I'd like to know what they are.
The ones in my ~/.bash_aliases
file are:
ls --color=auto
grep --color
phpunit --ansi
What else is there? Is there a list somewhere of all commands that support coloured output? Or better still, some command for grepping my local man pages and plucking out the appropriate command names.
Why don't you try:
That should search for the word color in all your man pages (content, not just headings).
It asks, for each man page, whether you want to open and view the page:
Inside each individual man page, you can use your normal search method (e.g.,
/color<ENTER>
) for finding the text. When done with a man page, just exit and it will continue searching.When looking at logs, you might enjoy
tail -f /var/log/messages | loco
for colorized output.There's a screenshot at the loco website and more examples at http://www.linuxhaxor.net/2008/01/02/perl-script-to-add-nice-colors-to-your-varlogmessages-file
This demo bash script colours directories red in most terminals - certainly works in xterms and cygwin under Windows. You can adapt the colours by fiddling with the escape codes - Google for LS_COLOR for lists of colour codes:
I'm quite fond of coloring my prompt so that it stands out. A useful article on that sort of thing is available here.
A quick bit of google search also reveals
grc
andgrcat
, which can be used to colorise any arbitrary text or command. Not sure how well they work though. I'm certainly going to try them out now that I've found them.Ah, here we go.
grc
uses the/etc/grc.conf
file to colorise a given command based on which regexp it matches. A quick grep of my (Ubuntu 8.10)/etc/grc.conf
reveals it currently has support for:But I'm sure you could add your own for other programs you are interested in.
To use
grc
, simply put it before the command you want to colorise (lets saydiff
):And you could certainly
alias diff='grc diff'
to makediff
colorised by default.