FreeBSD – Colorize Your Console

The FreeBSD console is colorless by default – but most terminals and SSH clients these days support color.  The benefits of colorizing your console should be pretty obvious.  It makes your life a little easier – you don’t have to do as much mental processing.

Below is a typical “ls -al” output, without color.  There’s a directory, an executable, an suid executable, a regular file, and a symlink.  If the files weren’t named like that, you’d have to do some mental processing to figure out which is which.

Now, take the same directory, but with color enabled:

That makes things easier, doesn’t it?  And that’s just for ls.

Grep can also support color output.  Here’s a grep without color:

And a grep with color:

For colors in ls, you need to set the CLICOLOR environment variable to “YES” – and for colors in grep, you just need to alias the grep command to ‘grep –color’.

I use bash as my shell, so my .bashrc looks like this:

alias grep='grep --color'
export CLICOLOR='yes'

So – there it is. That’s all I’ve got for now, but I intend to look for more ways to add a little color to your shell.

Rate this post

Related posts