$ mkdir ~/.terminfo $ infocmp > ~/.terminfo/xterm-color-noclear.terminfo $ nano ~/.terminfo/xterm-color-noclear.terminfo # 1. Change 'xterm-color' on second line to 'xterm-color-noclear' # 2. Remove 'smcup' and 'rmcup' $ tic ~/.terminfo/xterm-color-noclear.terminfo $ export TERM=xterm-color-noclear # Add export line to .profile
More info at: Synologic’s Stop gnome-terminal screen clear, Fix Log’s Stop gnome-terminal screen clear, and The Shallow Sky’s Exorcising the Evil Alternate Screen.
Update
I had to turn this off since it was affecting ssh terminals. Will revisit.
$ nano Error opening terminal: xterm-color-noclear.