Search Web......

Unix/Linux Display Variable

Unix Linux set display variable, setting display variable, what is display variable, export display variable, set env display variable value,how to set display variable,Command to set display variable, set command DISPLAY variable, remote display on unix, display unix screen on windows

Using Linux, and especially configuring Linux, normally require some insight, and we strongly suggest (to inexperienced Linux users) to get some help from a system administrator.

In short, you must open up a shell (csh, bash, etc), so that it is possible to issue commands on Linux. Then you must enter the commands to set the environment variable, as explained in the setup-instructions.

You must make sure that the command for setting the DISPLAY variable is called before starting the application server.

There are many discussions/guides on the Internet regarding this issue. Here is an extract from one:

1. What is DISPLAY variable?

The magic word is DISPLAY. In the X window system, a display consists (simplified) of a keyboard, a mouse and a screen. A display is managed by a server program, known as an X server. The server serves displaying capabilities to other programs that connect to it.

A display is indicated with a name, for instance:

* DISPLAY=localhost:4

The display consists of a hostname (e.g., localhost), a colon (:), and a sequence number (e.g. 0 and 4). The hostname of the display is the name of the computer where the X server runs. An omitted hostname means the local host. The sequence number is usually 0. It can vary if there are multiple displays connected to one computer.

If you ever come across a display indication with an extra .n attached to it, that's the screen number. A display can actually have multiple screens. Usually there's only one screen though, with number n=0.

Other forms of DISPLAY exist, but this will do for our purposes.

2. Telling the Client

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, and we're in domain If we're running a normal X server, the display is known as We want to run the drawing program xfig on a remote computer, called my.remote.machine, and display its output here on

If you have csh running on the remote computer:

remote% setenv DISPLAY
remote% xfig &

Or alternatively:

remote% xfig -display &

If you have sh running on the remote computer:

remote$ export DISPLAY
remote$ xfig &


remote$ xfig &


remote$ xfig -display &

It seems that some versions of telnet automatically transport the DISPLAY variable to the remote host. If you have one of those, you are lucky, and it's automatic. 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