TL;DR version at the end.
For the last couple of months or so, I had this super-duper-mega annoying issue with SSH sessions: any clear
command would miserably fail: the cursor was placed on top of the screen, but the screen… well, take a look at this short video here:
As I said, super annoying.
This happened suddently, at a moment I can’t really pinpoint (most likely one update that went rogue), so I kind of learned to work around the issue and ignore it.
Until today! I decided to bite the bullet and I start digging and find the source of this issue once and for all. The first clue was when i found that TERM=vt100; export TERM
would fix the issue. The only problem? Is was set per server AND per session, and I have this issue on every single server, so pasting that every time when I tried to connect was not really a solution.
Then I found out that I can send env variables from my PC to the remote machine. Yay! Is just that… I can send only some variables: the one that were blessed on the remote machine’s sshd_config
file. So this was no go too.
But then I found that there is this little variable that is sent AND accepted anyway: TERM
! This is when something clicked: echo %TERM%
in windows cmd echoed xterm
. Hmmm, I don’t remember putting that there!
So I simply changed that value to screen
, and… it works! Probably I could get away by simply removing that variable, but at this point I’m too afraid to try anything else
Hint: If you are not comfortable with setting env variables on windows, I strongly suggest this awesome piece of tool: REE.
TL;DR: set TERM
env variable to either linux
, screen
or vt100
.