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

I'm very new to screen but have configured my ~/.screenrc file according to various recommendations I've found on the internet. I have one issue with it though which I'm sure could be resolved very easily; I think it's a termcap setting..?

After using less, vim, top, or other programs in standalone bash (on Mac OSX 10.6), upon exiting these programs, the terminal's buffer will clear and the line above the current command line will be the previous command I entered.
However, with screen, when I exit any of these programs, the screen buffer won't clear / refresh and I'll still see what I was looking at inside that program.. Make sense??

e.g. in standalone bash (without screen):-

hostname:~ auser$ vim afile 
[do stuff in file, then :q to exit]

After exiting I'll see:-

hostname:~ auser$ vim afile 
hostname:~ auser$

But in screen:-

bash-3.2$ vim afile
[do stuff in file, then :q to exit]

After exiting I'll see a whole screen of:-

~  # [Empty lines in vim are represented by these tilda characters. ]
~  # [ Every line on the screen is one of these tildas ]
bash-3.2$   # [ This is the bottom line in the terminal ]

I hope that makes some sort of sense. Any & all help much appreciated! TIA

share|improve this question
So... what was your question again? – Ignacio Vazquez-Abrams May 16 '11 at 9:44
I just want what I've become used to... Surprise changes lead to hours of tinkering with settings I'm unfamiliar with – Alex Leach May 16 '11 at 14:38
up vote 5 down vote accepted

The answer lies in the terminal capabilities of both the "real" terminal that you are using and the terminal that is presented to applications via screen. Applications performing their terminal I/O via screen see a terminal of type screen. Your "real" terminal could be anything from xterm to vt100. (Use printenv TERM or equivalent to find out.)

TUI applcations like vim and less tailor their behaviour to whatever the terminal that they find themselves talking to is capable of. This answer is far too short for a detailed exposition of the mechanics of the terminfo mechanism, or even for the mechanics of how programs like vim and less make use of it. There are whole books on this stuff. A very brief précis is that your "real" terminal is advertising a capability that the screen terminal is not.

Plus, of course, this has already been answered on SuperUser at length, here and here and here.

share|improve this answer
Thanks! I got the answer from your 2nd link. Tick! – Alex Leach May 16 '11 at 14:33

put altscreen on in ~/.screenrc or Control+a:altscreen+Return

share|improve this answer

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.