Linux - DISPLAY (environment variable)
About
The magic word in the X window system is DISPLAY. 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.
The remote server knows where it have to redirect the X network traffic via the definition of the DISPLAY environment variable which generally points to an X Display server located on your local computer.
Articles Related
The environment variable
Value
The value of the display environment variable is:
hostname:D.S
where:
- hostname is the name of the computer where the X server runs. An omitted hostname means the localhost.
- D is a sequence number (usually 0). It can be varied if there are multiple displays connected to one computer.
- S is the screen number. A display can actually have multiple screens. Usually there's only one screen though where 0 is the default.
Example of values
localhost:4 gerardnico.com:0 :0.0
- hostname:D.S means screen S on display D of host hostname; the X server for this display is listening at TCP port 6000+D.
- host/unix:D.S means screen S on display D of host host; the X server for this display is listening at UNIX domain socket /tmp/.X11-unix/XD (so it's only reachable from host).
- :D.S is equivalent to host/unix:D.S, where host is the local hostname.
How to set the DISPLAY variable
Setting the DISPLAY variable, depend of your shell
- Bourne, Bash or Korn shell:
$ export DISPLAY=local_host:0.0
- C shell
% setenv DISPLAY local_host:0.0
In this example, local_host is the host name or IP address of the local computer that you want to use to display for instance an installation screen such as Oracle Universal Installer.