DISPLAY variable meaning

PROBLEM DESCRIPTION


The Display variable is a crucial aspect of the X window system. What is the purpose of the DISPLAY variable? (display, screen, number)



RESOLUTION


The DISPLAY variable in an X window system refers to the location of the X server, where applications like xterm are displayed.

The DISPLAY variable is divided into 4 different sections.

HOSTNAME:display_number.screen_number

  1. The first element, HOSTNAME, refers to the name of the UNIX/Linux machine that connects through a network. When making a connection via Xmanager, the name of the PC where Xmanager is installed is the IP address. There are, however, instances where the HOSTNAME does not exist and instead appears as unix. This means that the specific X application will not connect via TCP/IP but will instead connect via Unix Domain Sockets within a local X server. Xmanager users often, by habit, modify the DISPLAY variable in the login script, thus resulting in usage of an X server that is same as Xmanager. This results in not being able to properly run X applications.

  2. The colon element (:) determines if the X appplication will utilize Unix Domain Sockets or TCP/IP to establish a connection. An X window connection though a network usually utilizes the TCP/IP protocol, but utilizing the DECnet protocol is also possible. Xmanager was built mainly to utilize TCP/IP and therefore this article will not go into detail concerning DECnet. 

  3. The third element is the display number, also known as a server number. As explained earlier, you can look at it as the TCP Port that the HOSTNAME's X server reserves for a queued X application. The display number starts from 0. The display number, 0, plus 6000 represents TCP port 6000. When Xmanager is initiated, a display number is automatically set but can be adjusted manually if necessary. The Display number must have a value and cannot be omitted.

  4. The fourth element is the screen number. When the X server supports multiple displays, you can designate/assign a screen number individually to each monitor to take advantage of a multi-monitor display. As of right now, it isnt used much but if you cannot use xserver, since its using same hardware components as xterminal,  screen number may bring value. However, if xserver is called from a component that has xmanager also, this screen number has no meaning and is not used. This number can be created and when created, it represents 0. Lastly, when using xmanager to connect, DISPLAY is automatically configured, so it cannot be configured randomly.