Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I use GNU screen to run pine mail reader. I use external aspell to do spellchecking for the e-mails I sent. The problem is that when aspell finishes, pine restores the old content of the terminal, but the color is all wrong. The font becomes white instead of black, which looks very bad on the the gray background. After typing something for a while, pine redraws parts of the screen, and that looks ok, but initially it looks very hard to read.

The problem does not exist when pine is run directly, not from within screen. I do not know how to begin the troubleshooting. Any ideas?

Pine version: Alpine 2.00 (LRH 1167 2008-08-23) 
GNU screen version: Screen version 4.00.03 (FAU) 23-Oct-06

Update 11 Dec 2011: The problem also occurs in some cases when resuming composition with Ctrl+O (no aspell involed).

The following do not help:

  • Ctrl+L in pine to refesh screen,
  • adding "altscreen on" in ~/.screenrc
  • adding "bce on" or "bce off" in ~/.screenrc (I tried both, as I am not sure what the default is)
  • Starting screen with TERM=xterm-256color screen
share|improve this question

migrated from serverfault.com Dec 9 '11 at 21:01

This question came from our site for system and network administrators.

I'm not entirely sure, but you can try changing the TERM environment variable. What happens if you start screen like this TERM=xterm-256color screen and try pine? – phunehehe Dec 10 '11 at 15:34
Nothing changes. Also, I tried Ctrl+L in pine (which is supposed to redraw the screen), but there is no visible effect. – Boris Bukh Dec 11 '11 at 0:24
up vote 5 down vote accepted

I think I have resolved it. phunehehe was right about trying to change the terminal type. However, "TERM=xterm-256color screen" does not work because the TERM variable only tells screen what kind of terminal screen is run in. It does not tell screen to emulate that particular terminal. So, the solution was to include

term "screen-256color"

in ~/.screenrc configuration file. This seemed to solve the problem, but....

Update 12 December 2011: Actually doing the above fixed the color problem, but created another problem: Delete key no longer works in pine. It turned out that the computer on which screen is running lacks "screen-256color" terminfo file, and since it cannot find it, it reverts to the basic vt100 terminal. After trying several term settings, I found that "xterm-color" has neither Delete-key nor color problem. I do not understand why or how it works.

share|improve this answer
IIRC, you can copy the missing terminfo to a place in your home directory, and it will be used. (Apart from reading the docs, a way to find out where to put the file is by tracing the file accesses of a program; on Linux, with strace -e trace=file -fF program args.) – imz -- Ivan Zakharyaschev Dec 12 '11 at 12:09
Thanks! I tried reading the docs, but even figuring out which docs to read is not always easy. – Boris Bukh Dec 12 '11 at 20:03
sorry! It seems I was wrong: I've just tested my assumption with TERM=foobar strace -fF -e trace=file less /etc/altlinux-release 2>&1 | egrep -i '(term|foobar)' and seen that there were no attempts to access the terminal description in my home directory... That's strange, I believe that about 5 or 10 years ago I was able to put the missing terminfo files into my home directory. – imz -- Ivan Zakharyaschev Dec 12 '11 at 20:33
Perhaps, you can still make it use your terminfo files without being root: check out TERMINFO and TERMINFO_DIRS environment variables -- lists.debian.org/debian-user/2009/09/msg00694.html . – imz -- Ivan Zakharyaschev Dec 12 '11 at 20:38
But this behavior in my system seems to be contrary to the terminfo(5) manpage: "If TERMINFO is not set, the ncurses version of the terminfo reader code will instead look in the directory $HOME/.terminfo for a compiled description.". Perhaps, it's only a problem of the package in my distro; try it out yourslef. – imz -- Ivan Zakharyaschev Dec 12 '11 at 20:48

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.