Change terminal type for screen over a serial connection

6,137

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.

Share:
6,137

Related videos on Youtube

Hamza
Author by

Hamza

Updated on September 18, 2022

Comments

  • Hamza
    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 default vt100 is pretty restrictive in terms of colours and scrolling etc.

    The screen manual suggests the configuration option termcapinfo but using that doesn't fix the issue.

    On the host machine, TERM is set to xterm-256color and when I connect to the target, using the termcapinfo setting in my .screenrc, TERM is still set to vt100.

    I am thinking maybe I should set something on the target machine?

  • Hamza
    Hamza over 10 years
    Thanks, 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 sets TERM=xterm-256color. What would be the equivalent file or mechanism to a serial connection?
  • Stéphane Chazelas
    Stéphane Chazelas over 10 years
    .bashrc should not set TERM, TERM is set by the terminal emulator itself, and passed by ssh to the shell started by sshd 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 starts login 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.