How to force `screen` to clear the terminal after commands like `htop`

fullscreengnu-screenterminal

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?

Best Answer

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’.

Related Question