Make My Terminal Beautiful, Part 1

October 9th 2011

Tags: utilities, git

I spend most of my time working staring at a terminal. In fact, I'm writing this post in vim on the terminal right now. Terminal tools with color have been the norm for quite some time. Even the default installs of the major Linux distros ( Ubuntu ) enable color and alias all the right commands for you.

Getting Started

How do you configure these manually? Well, most of the time it's pretty simple. Here are some of the settings I use every day to make my terminal beautiful:

Lets set some of the basics. In your ~/.bashrc, try some of the following:

export CLICOLOR=1 # This will enable colors in ls by default
export LSCOLORS="color_code_string" # Customize your ls colorscheme
export GREP_COLOR=auto # Apply grep color automatically

Great, now ( once you either source ~/.bashrc to refresh your settings in your current terminal or by opening a new one ) you should have some nice colors for some of the most basic utilities.

Next, lets look at some of our tools. To configure colors in git try:

git config --global --add color.ui true

For Mercurial, follow the directions for the ColorExtension.

Brilliant. Though... if you start an editor like vim, you will be greeted by some fairly ugly default color scheme ( but more on that in part 2 ).

I Want More

Lets check to see what type of terminal you are using.

echo $TERM

On my machines I will see:




or maybe even:


This means the terminal emulator I'm using is presenting itself as a 256 color compatible xterm. If you do not see any of these, check the preferences for your favorite terminal application. A note for Mac users: on Lion supports 256 color mode, but older version do not. Try iTerm2 as an alternate terminal emulator.

We can check to see how many colors are supported for the listed terminal type in our local terminfo:

tput colors

On my machines, I see something along the lines of:


Which sounds about right. If there is any other number there then either:

Taste The Rainbow

Now lets try a visual test. Try running ( shamelessly lifted from ). In a properly configured 256 color terminal, it should look like:

Good 256 Colors

Something like:

Bad 256 Colors

Means you have problems. Refer to the notes above, or ask me a question in the comments.

That's all for now, more in Part 2.


Changed info, in Lion it supports 256 colors.

By Colin Kennedy