Colorize your stdout with xcol

This little tool will colorize its standard input with a different color for each one of its arguments.


xcol imitates the usage of grep, so you can pipe any stdout to it

, or read from a file

Just like grep .

You can match any regular expression that sed  would accept

I recommend it also for things like monitoring logs. Try something like


Get the code from github, and append it to your .bashrc or .zshrc.

To do it in one step, paste the following in your zsh terminal

, or in bash

the xcol  command will be available next time you open a new terminal.


In my daily work, I have always made heavy use of  grep --colour  as a simple way of highlighting whatever I am interested in on a piece of text. I use so much that I aliased it as alias grep='grep -i --colour' .

When you use grep like this, often you lose information of the context around whatever you want to highlight. Sure, you can use grep -C2 or grep -z , but it is more cumbersome to use and still not that great.

While trying to find my way around this, I came across this wonderful post by Andreas Schamanek. He had put the effort into exactly what I was too lazy to do myself. Awesome!

So I tweaked it a little bit to run in zsh, and created a wrapper around it so you do not have to decide what color goes for each match, which in my case comprises 99% of the use cases. I gave it a grep like invocation flavour.

And so, xcol came to life


Author: nachoparker

Humbly sharing things that I find useful [ github ]

One Commnet on “Colorize your stdout with xcol

Leave a Reply

Your email address will not be published. Required fields are marked *