Change terminal type for screen over a serial connection
It's the remote machine that sets $TERM
to vt100
, because it cannot know what terminal emulator your connecting with. vt100
is a safe value as the majority of modern terminals and terminal emulators (including screen
) are compatible.
To tell the applications over there what your terminal actually is, you have to set $TERM
explicitely:
TERM=screen
You can do:
find $(infocmp -D) -printf '%f\n' | sort -u | grep screen
to see if there are more appropriate entries like screen-256color
.
Related videos on Youtube
Hamza
Updated on September 18, 2022Comments
-
Hamza over 1 year
I am connecting to an embedded Linux board using
screen
over a serial link and trying to change the terminal type, as the defaultvt100
is pretty restrictive in terms of colours and scrolling etc.The
screen
manual suggests the configuration optiontermcapinfo
but using that doesn't fix the issue.On the host machine,
TERM
is set toxterm-256color
and when I connect to the target, using thetermcapinfo
setting in my.screenrc
,TERM
is still set tovt100
.I am thinking maybe I should set something on the target machine?
-
Hamza over 10 yearsThanks, I had a suspicion that I needed to add this to the target machine. Follow-up question: When I ssh into a machine,
.bashrc
gets executed and setsTERM=xterm-256color
. What would be the equivalent file or mechanism to a serial connection? -
Stéphane Chazelas over 10 years
.bashrc
should not setTERM
,TERM
is set by the terminal emulator itself, and passed byssh
to the shell started bysshd
as part of the ssh protocol. In case of a serial console, the client cannot send a variable across the serial connection like that. It depends what application runs on that serial device. If it's a getty that startslogin
that starts bash (your login shell) as a login shell, then you could put the definition in your~/.bash_profile
. Something like[[ $(tty) = /dev/ttyS* ]] && TERM=screen-256color ]]
to set $TERM whenever the tty is a serial one.