xterm-background-colours

Easy to find xterms.

Background

Unix/Linux System administrators tend to run lots of xterms on different hosts at once. Very occasionally, they type a command into the wrong window, and accidentally reboot the wrong server. Ooops. DBAs do this too, and drop a table on the live database rather than the development copy. This is all quite embarrassing, and best avoided.

A common strategy is to give each xterm window a different background colour. This makes it quicker to pick out the window you want, and has the bonus that it's a bit more obvious if you're typing into the wrong one.

People often make themselves a little menu to open new xterm windows on the hosts that they look after. They hard code colours into here, hand picking them per host, or maybe using a colour for each application. This doesn't scale too well.

Xterm-background-colours to the rescue!

It picks a colour for you based on the name of the host, so you don't have to worry about setting it up every time you install a new server. It only uses colours that give good contrast against the foreground text, and uses easy-on-the-eye ANSI colours from the Tango palette. It always uses the same colour for a given hostname, so when you're looking over a colleague's shoulder you get what you expect.

Screenshots

Everyone loves a screenshot or two.

Download

xterm-background-colours

It's a Perl script, so just make it executable and stick it somewhere in your PATH, such as /usr/local/bin.

Usage

  1. xterm-background-colours hostname
  2. xterm -name xterm-hostname
  3. alias xterm="xterm -name xterm-`hostname`"

I imagine you've already got your own script/menu for opening new xterms via ssh/rsh, into which you can plumb in steps 1 and 2. You'll want to add 3 to your .profile.

More!

Now you're hooked on colouring everything, you might want to do the same thing with your Firefox tabs.

You can also use the Tango colours with PuTTY.

Back to home