Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have screen compiled with 256 colors, running on Konsole in 256 color mode. If start screen, the TERM is set to "screen". If I manually export the TERM to screen-256color everything works beautifully.

I have two questions. The first is why screen is setting the TERM to "screen" instead of "screen-256color" when it supports this? The second is, if I have the following line in my .screenrc file

term    screen-256color

why is screen still not setting my term?

Additional information: I'm running Screen version 4.00.03jw4 (FAU) 2-May-06 on Kubuntu Jaunty amd64

share|improve this question
term screen-256color works here with screen version 4.00.03jw4 (FAU) 2-May-06 on Debian testing. More details, please. – derobert Jun 5 '09 at 5:13
I appear to be running the same version of screen as you. I wonder if it's a terminfo problem? – Zxaos Jun 5 '09 at 16:26
Yes, most likely your terminfo does not have screen-256color, so screen correctly refuses to set terminfo to that, since the apps you'd run under it would fail – njsf Jun 6 '09 at 3:02
If I set it by hand things work and 'tput colors' echoes the correct number of colors. At any rate, I don't know enough about terminfo to fix this, then. Any suggestions? – Zxaos Jun 6 '09 at 4:45
If tput works, then you have the terminfo records. – derobert Jun 7 '09 at 0:50

Screen always sets TERM to "screen" by default. Nevertheless, you should realize that a TERM=screen still supports colors.

I tested adding "term screen-256color" to my ~/.screenrc and it does set the TERM to "screen-256color" for me (Screen version 4.00.03 (FAU) 23-Oct-06). Is it possible that screen is looking in the wrong place for your .screenrc file?

You can also try launching screen as follows:

screen -T screen-256color

See if that works.

share|improve this answer
Specifying the terminal by hand launches screen with the correct term. (The reason I care is that Vim doesn't seem to want to play nice, color wise, with screen instead of screen-256color unless I force it into 256 color mode. As to if screen is looking for my .screenrc in the wrong place, how would I check that? – Zxaos Jun 9 '09 at 0:40
Thanks, your suggestion lead me to figuring out that it was the installed screen profiles which were messing with the parsing of my .screenrc . – Zxaos Jun 9 '09 at 0:50
up vote 4 down vote accepted

The issue actually turned out to be some conflicting screen-profiles that were installed on my machine. Although they sourced my local .screenrc, they prevented me from setting the term. Disabling the use of profiles (I renamed the symlink ~/.screen-profiles to something else) caused screen to read the term as set in my .screenrc file.

share|improve this answer

Add in your '~/.screenrc':

attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"
share|improve this answer
Nope. The TERM variable is still set to 'screen' even when starting screen with that present in the .screenrc – Zxaos Jun 5 '09 at 16:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.