I have recently started using screen in order to be able to split my terminal vertically and horizontally. However, it does not clear the terminal automatically. For example, when I open a file using vim and then I close it, the screen fills the terminal with the content of file. Is there a way to fix it and make it like normal Terminal?


You're probably thinking of the alternate screen feature, which allows full-screen applications such as htop to display in a different view, and on completion returning to the normal view (without the application showing). That is the altscreen setting in your .screenrc, described in the manual:

Command: altscreen state

If set to on, "alternate screen" support is enabled in virtual terminals, just like in xterm. Initial setting is ‘off’.

  • It works. There wasn't any .screenrc file at the beginning; I created one and put the altscreen on in it.
    – orezvani
    May 12 '16 at 23:45

In the terminal type


That should do the trick

  • clear will clean the screen, but I want the output of previous commands to be there. Let's say I run htop and close it, I want the output to be cleaned.
    – orezvani
    May 12 '16 at 8:33

Ctrl+L over the dirty screen

  • You don't have to do that with a normal Terminal
    – Anthon
    May 12 '16 at 9:08

Normally screen command help to keep our session live irrespective whether you have closed the putty or remote session from your workstation. we can again resume to same screen anytime if we have not detached screen (Ctrl + A and Ctrl + D ).

are you using screen in any script?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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