There is no need to dump the "Linux" terminals. They belong to a very large family of character-mode terminals and terminal emulators. HP-UX is one of the very few Unix's that understands hundreds of different models. The reason you see TERM=linux is that you are using the default /etc/profile where the (archaic) code checks to see if the TERM value was preset when the terminal logged in. This code assumes that 100% of all incoming connections come from HP-UX systems. It turns out that protocols such as telnet have subcodes that communicate certain features between systems. One of these options presets the TERM variable. As long as the incoming system is using one the hundreds of terminal models listed in the terminfo database (see: ll /usr/lib/terminfo/terminfo/*/*) then it may work.
I say "may work" because an incoming system may say it uses a certain terminal protocol but may not. HP recognized this problem a long time ago and created a terminal identifier program: ttytype. What the program does is to query the terminal with the 3 most common terminal categories. If one query fails, the program times out and tries another. Once a response is seen, some additional codes are sent to further identify the exact model and set TERM, LINES, COLUMNS and ERASE. Try this:
ttytype -s
You'll see that the terminal is queried and for your Linux terminals, some version of vt100 series will be returned.
The problem is that the default code in /etc/profile bypasses this critical setup if TERM is already set. This makes no sense because there is no reason to expect that other systems set the TERM value correctly in the communication protocol.
So replace all this archaic code in /etc/profile:
# set term if it's not set
if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi
export TERM
# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
stty erase $ERASE
with this one line:
eval $(ttytype -sa)
Now, every terminal will be identified at login and the appropriate settings will be in force.
Bill Hassell, sysadmin