[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Where is $TERM documented?

From: Greg Wooledge
Subject: Re: [Help-bash] Where is $TERM documented?
Date: Mon, 6 May 2013 08:55:07 -0400
User-agent: Mutt/

On Sat, May 04, 2013 at 12:40:00PM -0500, Peng Yu wrote:
> Hi,
> I see the following variable in my bash. But I don't find it in the
> bash manual. Does anybody know where it is documented? Thanks.
> ~$ echo $TERM
> xterm-256color

In addition to what the others have already told you, TERM is the index
into a terminal capabilities database, which is handled by your operating
system.  There are two competing terminal capabilities database standards,
of course (this is Unix, after all).  BSD systems use "termcap", and
SysV systems use "terminfo".  On many modern systems, such as Linux,
the operating system uses one of these natively and emulates the other
for compatibility.

"xterm-256color" sounds new-ish, so you're probably on Linux, and you're
probably using the terminfo implementation that comes with ncurses.  But
that's just a guess.

Typically the REAL question in these cases is something like "I'm sshing
to a remote host and it says unknown terminal type".  In that case, what
you need to do is:

 1. Find out which terminal database the remote host is using (termcap
    or terminfo).
 2. Find an uncompiled terminal database entry for your terminal type.
    This is relatively easy if your local system uses the same database
    as the remote system, because then you can just use your local
    database entry.
 3. Ship the uncompiled database entry over to the remote system.
 4. Compile/install it.

If both systems are using terminfo, then that goes something like this:

  infocmp > myterm
  scp myterm remote:
  ssh remote
    mkdir -p ~/.terminfo
    tic myterm  # or sudo tic myterm if you have root access and you want
                # it to be installed system-wide

See "man tic" on Linux.

A common workaround for people who do not know how to perform all those
steps is:

 1. Find a TERM variable that *does* work on the remote system, without
    breaking your terminal too egregiously.

In any case, this is operating system specific stuff, not bash stuff,
so the correct place to ask for help would be your (remote) operating
system's support list.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]