Modify $TERM from config

Mike Kelly mike at
Wed Jun 27 06:30:20 EST 2012

On Tue 26 Jun 2012 04:09:05 PM EDT, Chris Adams wrote:
> Once upon a time, Bob Rasmussen <ras at> said:
>> Perhaps the answer to this is to bring forward a concept from the telnet 
>> protocol, into SSH. When a telnet client connects, it doesn't just say 
>> "I am TERM=ABC". Instead there is an option negotiation process defined. 
>> So if the server responds "I don't know what terminal ABC is", the client 
>> can try "I am TERM=XYZ". This process can continue until the client 
>> decides what is the best fit, and tells the host.
> That would be cool.  However, I'm trying to deal with hosts that are not
> as up-to-date already (e.g. have a smaller terminal database), so a new
> extension would unfortunately not help me much (since those same hosts
> would probably not support it for years).

I've usually handled this with some code in my ~/.bashrc that just
changes and re-exports the TERM variable early on, if it looks like one
that that host doesn't support. I've done this in an ad-hoc way, so I
don't have some nice universal thing to share, but, for example:

  [[ "${TERM}" == "rxvt-unicode-256color" ]] \
    && export TERM="rxvt-unicode"

I'm sure there's something that can be done with some terminfo command
or something. I think someone mentioned handling different LANG
settings, and I do that this way:

  if [[ -x "$(type -P locale)" ]] ; then
    case "`locale -a`" in
    [[ -n "${LANG}" ]] && export LANG SUPPORTED="${LANG}:en_US:en"

Mike Kelly

More information about the openssh-unix-dev mailing list