What is the difference between xterm-color & xterm-256color?

Go To StackoverFlow.com


I've come across both xterm-color and xterm-256color as options when trying to set up my terminal program to use color - i.e. you can set your TERM environment variable to either one.

I was wondering if anyone can describe the difference between the two?

I've searched for documentation on my ubuntu server as well as my mac but haven't found any. I've only been able to find various binary files in /usr/share/terminfo

2012-04-03 23:56
by user12345
You can determine yourself whether your terminal supports 256 colors - Franklin Yu 2017-12-22 22:10


xterm-256color describes Xterm with support for 256 colors enabled. xterm-color describes an older branch of Xterm that supports sixteen colors. xterm-color is not recommended, since it describes a variant of Xterm that’s less functional and that you’re not likely to be using. Usually you’ll want to use xterm, xterm-16color or xterm-256color.

In particular, xterm-256color is the default for Terminal starting with Mac OS X 10.7 Lion, with the next-best recommended values being xterm-16color or xterm (which only describes support for eight ANSI colors). Prior to 10.7, xterm-color was the default because Terminal didn’t support some critical features described by the recommended Xterm terminfo values, e.g., Background Color Erase (BCE), modern codes for switching main/alternate screens, 256 colors.

Sometimes people explicitly set TERM to xterm-color (as opposed to the recommended Xterm values) to disable functionality or work around incompatibilities between the available terminfo values on a particular computer and the terminal emulator being used.

Note that technically Terminal should have its own up-to-date terminfo values that describe exactly which features it supports, instead of using the values for Xterm, but:

  1. There isn’t one that’s up to date currently. nsterm represents Terminal’s ancestor from NeXTSTEP. Someone apparently has updated nsterm recently (sometime in the past couple of years), but I don’t know whether that has made its way into the ncurses distribution, and it may not be completely up to date with Terminal in 10.7.
  2. A number of programs and shell customization scripts explicitly check whether $TERM starts with (or is equal to) xterm. So some users would still need to know about using the recommended Xterm values with Terminal for compatibility with those.

If you’re not familiar with the terminfo system, take a look at the x-man-page://5/terminfo man page. Also, you can use the infocmp command to view the current terminfo settings or compare two different ones, e.g., infocmp xterm-color xterm-256color will show you all the differences between those two.

2012-04-06 05:04
by Chris Page


It appears that xterm-256color is Terminal.app on OS/X. The differences are not tiny - I infocmp'd xterm-color and xterm-256color on an Ubuntu box and normalized them a bit, and got quite a few differences. I might even say xterm-256color isn't really xterm anymore.

Normally when you use a specific terminal emulator, you need to "just know" which terminfo entry works best with it. They're a matching pair, though sometimes you can, EG, use a vt100 terminfo entry on a vt220 terminal.

On the plus side, almost everything is vt100-compatible today.

2012-04-04 00:17
by user1277476
“I might even say xterm-256color isn't really xterm anymore.” You mean not just Xterm anymore, because several popular terminal emulators support many of the same features - Chris Page 2012-04-06 05:05