DISPLAY=:0 and what does it mean?
It isn't a command, is it? (
gnome-panel is a command.)
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
DISPLAY=:0 gnome-panel is a shell command that runs the external command
gnome-panel with the environment variable
DISPLAY set to
:0. The shell syntax
VARIABLE=VALUE COMMAND sets the environment variable
VARIABLE for the duration of the specified command only. It is roughly equivalent to
(export VARIABLE=VALUE; exec COMMAND).
The environment variable
DISPLAY tells GUI programs how to communicate with the GUI. A Unix system can run multiple X servers, i.e. multiple display. These displays can be physical displays (one or more monitor), or remote displays (forwarded over the network, e.g. over SSH), or virtual displays such as Xvfb, etc. The basic syntax to specify displays is
HOST:NUMBER; if you omit the
HOST part, the display is a local one.
Displays are numbered from 0, so
:0 is the first local display that was started. On typical setups, this is what is displayed on the computer's monitor(s).
Like all environment variables,
DISPLAY is inherited from parent process to child process. For example, when you log into a GUI session, the login manager or session starter sets
DISPLAY appropriately, and the variable is inherited by all the programs in the session. When you open an SSH connection with X forwarding, SSH sets the
DISPLAY environment variable to the forwarded connection, so that the programs that you run on the remote machine are displayed on the local machine. If there is no forwarded X connection (either because SSH is configured not to do it, or because there is no local X server), SSH doesn't set
DISPLAY explicitly causes the program to be displayed in a place where it normally wouldn't be. For example, running
DISPLAY=:0 gnome-panel in an SSH connection starts a Gnome panel on the remote machine's local display (assuming that there is one and that the user is authorized to access it). Explicitly setting
DISPLAY=:0 is usually a way to access a machine's local display from outside the local session, such as over a remote access or from a cron job.
It's an environment variable that is passed just to that program, rather than the shell as a whole. This happens when you set a variable on the same line as a command.
X11 programs need to know where to display windows, since it's a client/server system and you could be displaying on a remote machine. This simply means use the first display on the local machine.
This is normally set up automatically when logging in to a desktop environment. For example, open a graphical terminal and type