Operating System - HP-UX
1843980 Members
1734 Online
110226 Solutions
New Discussion

Re: diff TERM and DISPLAY

 
amit kumar_5
Occasional Contributor

diff TERM and DISPLAY

hi all
can any body tell me the env variable TERM and
difference beetween TERM and DISPLAY.
thanks and regards
amit kumar
4 REPLIES 4
Henk Geurts
Esteemed Contributor

Re: diff TERM and DISPLAY

hi Amit.
the TERM variable sets the TERMinal value.
most commonly used are vg100/vt220/hp
e.g.
# export TERM=vt100
or
# export TERM=hp

The DISPLAY variable shows where graphical output must be send to...
most commonly it is set as an ip-adres.
eg.
# export DISPLAY=10.124.3.211:0.0

regards.
Victor Fridyev
Honored Contributor

Re: diff TERM and DISPLAY

Hi,

TERM defines behavior of an opened terminal, DISPLAY defines on what host to open terminal by X application.

If you want to open xterm application on machine called foo, you write on your computer
export DISPLAY=foo:0.0

Now, if you want to change kind of terminal behaviou, you can in the opened window define export TERM=vt100 or vt200 or whatever you need.

HTH

Entities are not to be multiplied beyond necessity - RTFM
Delrish
Trusted Contributor

Re: diff TERM and DISPLAY

TERM contains the name or type of your terminal.It is usually set through /etc/profile shell startup file using either the tset or ttytype command.Comand like more and vi need this variable to display files correctly on different terminals.
DISPLAY contains the host name or ip address of remote box that your server should use to send XF86 based application to it.
Bill Hassell
Honored Contributor

Re: diff TERM and DISPLAY

It is very easy to confuse the two when Xwindows (the graphics subsystem on Unix) is confused with Unix (which is a commandline-based system) terminal interfaces. The majority of Unix admins seldom work with pictures, drawings, color designs, etc, yet they will always start a window that is emulating a 'real' terminal. So the basic way to talk to the HP-UX system is using the shell command line. And the method of communication is a terminal, a glass teletype or keyboard+display.

Now there are hundreds of terminal models, dozens of manufacturers, each with varied capabilities and standards. Now with a command line, none of these variants are important. All that is needed is a plain ASCII terminal so things like LINES and COLUMNS are unimportant. But take something extremely complicated like vi, and everything changes. vi needs to know hundreds of special features from LINES and COLUMNS to the spcial codes to move the cursor around the screen. Now all those features make the terminal differences very important. So a special library of routines called Curses was created that could accomodate all these differences. The library defines tasks which a program (like vi) needs to accomplish, and a database of character codes is consulted to produce the desired task. That's where TERM comes in Once TERM matches the terminal being used, all the correct codes will be used by the program. But manually set TERM without regard to the actual terminal (or more common, an emualtor program on a PC) and vi will be a mess on the screen.

To simplify everything, HP-UX has a smart terminal ID program called ttytype which will query your terminal at login and set TERM correctly.

Now DISPLAY has nothing whatsoever to do with TERM. DISPLAY is an IP address, a display identifier and a workspace and is used by Xwindows to direct all the colors and decorations and mouse/keyboard communication to a display server (the screen + keyboard + mouse). On a graphics workstation, these 3 items are self-contained, but the application program will use whatever the IP address is specified by DISPLAY.

So where this gets confused is when you are running in an Xwindow environment and start a terminal program. The DISPLAY value simply points to the display server where the colors and text will be displayed, but the terminal program (such as dtterm, xterm or hpterm) will login and must have TERM set correctly. Unfortunately the default Xwindow environment bypasses the normal login profiles so the TERM value is often mis-set. To see if it is correctly set, once you are logged into HP-UX, type these two commands:

ttytype -s
echo $TERM

The TERM value should match and if so, your text window is ready to use.


Bill Hassell, sysadmin