The client program (for instance, your graphics application) knows which display to connect to by inspecting the DISPLAY
environment variable. This setting can be overridden, though, by giving the client the command line argument -display hostname:0
when it's started. Some examples may clarify things.
Our computer is known to the outside as light, and we're in domain uni.verse. If we're running a normal X server, the display is known as light.uni.verse:0
. We want to run the drawing program xfig on a remote computer, called dark.matt.er
, and display its output here on light.
Suppose you have already telnetted into the remote computer, dark.matt.er
.
If you have csh running on the remote computer:
dark% setenv DISPLAY light.uni.verse:0 dark% xfig &
or alternatively:
dark% xfig -display light.uni.verse:0 &
If you have sh running on the remote computer:
dark$ DISPLAY=light.uni.verse:0 dark$ export DISPLAY dark$ xfig &
or, alternatively:
dark$ DISPLAY=light.uni.verse:0 xfig &
or, of course, also:
dark$ xfig -display light.uni.verse:0 &
It seems that some versions of telnet automatically transport the DISPLAY
variable to the remote host. If you have one of those, you're lucky, and you don't have to set it by hand. If not, most versions of telnet do transport the TERM
environment variable; with some judicious hacking it is possible to piggyback the DISPLAY
variable on to the TERM
variable.
The idea with piggybacking is that you do some scripting to achieve the following: before telnetting, attach the value of DISPLAY
to TERM
. Then telnet out. At the remote end, in the applicable .*shrc
file, read the value of DISPLAY
from TERM
.