Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding linux DISPLAY variable

Tags:

linux

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 :1001.

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

like image 390
codingenious Avatar asked Jan 06 '14 10:01

codingenious


People also ask

What is display variable in Linux?

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 .

What is X11 display variable?

The DISPLAY environment variable instructs an X client which X server it is to connect to by default. The X display server install itself normally as display number 0 on your local machine. In Putty, the “X display location” box reads localhost:0 by default.

What is the purpose of the display environment variable?

This variable is used to indicate to graphical applications where to display the actual graphical user interface, the value consists of 3 parts: A host-name followed by a colon (:), a display number followed by a dot (.) and a screen number.

How does display work in Linux?

The Linux's display system, uses multiple technology, protocols, extensions, applications, servers (daemon), drivers and concepts to achieve the windowing system for instance: Xorg, Wayland, X11, OpenGL, RandR, XrandR, Screen Resolution, DPI, Display server, etc.


2 Answers

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.

like image 186
Roger Lipscombe Avatar answered Sep 20 '22 14:09

Roger Lipscombe


The DISPLAY values are usually like :0, :0.0, etc. when running under the X Window server on the same host. Big numbers like in :1001 are typical for SSH passed X connection. The numbers are really summand to 6000 to get TCP port number; local ones start with 6000 and SSH passed ones could start with 7000. (This augment is different in different systems, e.g. 10 or 100 are also possible.)

As soon as these values are assigned dynamically, you should get the value for DISPLAY from an existing connection environment, provided that proper authorization token is also available (e.g. in ~/.Xauthority).

like image 39
Netch Avatar answered Sep 18 '22 14:09

Netch