Department of
Physics & Astronomy


Main Page
  • Computer System
    • The DISPLAY Variable

Setting the DISPLAY Environmental Variable

The Problem

Many Unix applications need to open additional windows, generally for graphics. They use the environmental variable DISPLAY to tell them on what computer to open the window. If the environmental variable is not set, you will get the following error:
      IDL> plot,indgen(100)
      % PLOT: Unable to open X Windows display: 
      	Is your DEVICE environment variable set correctly?
      	% Execution halted at $MAIN$   (PLOT).
If the value of DISPLAY is set to someone else's computer, your window will pop up on their computer screen!

The Solution

The DISPLAY variable needs to be set to the IP address of your computer, followed by a screen address, which can always be taken to be :0.0 . Here are some examples corresponding to different situations.
PC in the Terminal Room
   hodge:drodman% setenv DISPLAY
The last three digits of the computer name are different for each PC in the room.
PC in Faculty Office
   hodge:bland% setenv DISPLAY
Using XWIN over PPP Modem Connection
   hodge:bland% setenv DISPLAY
The number is the temporary IP address assigned to you when you establish a PPP connection. You can find it in the TRUMPET WINSOCK SETUP window, if you are using the WINSOCK provided by the University. It is different every time you connect.
Running from a GraphOn terminal in the Terminal Room
   hodge:bland% setenv DISPLAY unix0:0.0
Actually I am not too sure about this one. The name could be unix1, unix2, unix3, etc., and is assigned when you log on. It might be better to log directly onto the machine you are going to run on, in which case the DISPLAY variable will be set correctly by the system.