Current Linux terminal emulators have a feature that many people consider a bug.
Read the manual of some command. Find what you wanted to check. Quit the viewer to return to the command line. Poof, your screen is restored to what it was before you started man, and the information you were looking for is gone.
Same if you start your editor; quit the editor and the screen restores to the previous content.
This is due to a feature that’s called alternate screen that’s been in emulators for a long time. And Linux has a terminal capabilities definition database – termcap – that defines how an application like vi or less communicate to the terminal. At some point in the past, someone decided it would be nice if, when starting a “full screen” application, the terminal switched to the alternate screen, and when ending the application, the terminal switched back. They put this in the terminal definition file – and ever since, this turns people like me crazy.
Well, it seems like it doesn’t turn everybody crazy, else it would long have been fixed. But googling for “linux terminal tite” finds lots of links from people who try, in some way, to get rid of that behaviour. What works for many is changing their termcap. However …
if you are like me, and ssh into other computers a lot, you need to change the termcap on each of them. Doh!
There is hope: use the plain old xterm. If you press the middle mouse button on it, it has a menu item that disables alternate screen switching. Other terminal emulators, like putty, have a similar thing. Which is why i’ve always been using those, instead of gnome-terminal or xfce4-terminal.
One and a half years ago, i finally tried to do something about it and add this feature. Unfortunately, i ran into a brick wall — those emulators don’t do the emulation themselves; they use a library named vte for that. This is a different code base, so you need to get the feature into vte first, then start patching the emulators. So, in December 2014 decided to contribute to vte, made a nice patch on github, created a pull request .. and nothing happened, for one and a half years.
Now, i decided to move to Ubuntu 16.04 LTS, and still, no change of the situation. So i decided to, at least, fix the behaviour for me. This led to two patches (xfce-terminal and gnome-terminal use different versions of vte, so you need to patch both).
For xfce-terminal that comes with XUbuntu, you need to install your own versions of libvte9 Download, like this:
sudo apt-get build-dep vte
apt-get source vte
patch -p0 < ../libvte-gtk2.patch
debuild -us -uc -b
sudo dpkg -i libvte9_0.28.2-5ubuntu4_amd64.deb libvte-common_0.28.2-5ubuntu4_all.deb
and for gnome-terminal, you need to patch libvte-2.91-0 Download, like this:
apt-get source libvte-2.91-0
patch -p0 < ../libvte-gtk3.patch
debuild -us -uc -b
sudo dpkg -i libvte-2.91-0_0.42.5-1ubuntu2_amd64.deb libvte-2.91-common_0.42.5-1ubuntu2_all.deb