Search code examples
linuxenvironment-variablesxserver

Understanding linux DISPLAY variable


I am new to Linux and I had to set DISPLAY variable for running a Java application. Somehow I managed to do that, and I understand that display can be set using

<host>:<display>[.<screen>]

but what I am doing is <host>:1001.

Now, this 1001 is 1001th display of this Linux? Are this many display possible in a machine or my understanding is wrong?


Solution

  • The DISPLAY variable is used by X11 to identify your display (and keyboard and mouse). Usually it'll be :0 on a desktop PC, referring to the primary monitor, etc.

    If you're using SSH with X forwarding (ssh -X otherhost), then it'll be set to something like localhost:10.0. This tells X applications to send their output, and receive their input from the TCP port 127.0.0.1:6010, which SSH will forward back to your original host.

    And, yes, back in the day, when "thin client" computing meant an X terminal, it was common to have several hundred displays connected to the same host.