previous contents up next

Unix for Advanced Users

16. X and Simple X Configuration

16.1 Basics

X, X11, and the X Window System are equally legimitate names for the de facto standard windowing environment for Unix. X was originally developed at MIT, starting in 1984. From the beginning, its aim has been not only to provide a foundation for graphical applications, but also to spread such applications across the network, using available CPU and memory resources to optimal efficiency. To this end, X is built on a client-server model. Applications may run on one machine and display on another, so that the heavy-duty computations can be done on the machine with the fastest CPU and most memory, while the work of drawing the display is done on the machine with the nicest monitor and graphics card. Since this functionality is built into X, it is automatically available to any X application.

Besides this client-server protocol, X consists of low-level interfaces to different graphics cards and libraries for drawing primitives. Toolkits of components for building applications, like Qt and GTK, are themselves built on top of these libraries. This modular design allows for great flexibility in the look and design of applications, just as the X protocol allows for flexilibility in the distribution of work.

16.1.1. X is network extensibile

Probably the most appealing feature of X from the outset has been the fact that it is network extensible. Essentially, you can have one machine open windows on remote machines over the network. X makes a graphical environment available to users without the need to be located in front of the physical console. For example, Unix servers today are seldom purchased with a head (i.e. a graphics card and a monitor) since X makes this unnecessary.

16.1.2. Displaying a window over the network

In order for machine mymachine (say it is sitting in front of you) to display X applications running on a remote machine called remotemachine,
  1. mymachine has to be running an X server. Most Unix machines these days meet this requirement out of the box. If you see a graphical login screen, it is almost certain that an X server up and running.
  2. You must give mymachine permission to display incoming from remotemachine. This is done via the xhost or xauth commands:
      xhost + remotemachine (on mymachine)
  3. The X application on remotemachine must point to mymachine via the DISPLAY environment variable. The DISPLAY variable can be set on remotemachine in the usual manner, namely:
      DISPLAY = mymachine:0, export DISPLAY (for Bourne-like shells)
      setenv DISPLAY mymachine:0 (for C-shell and derivatives)
    Once DISPLAY is set, you can fire an X application (such as xterm) on remotemachine and it will display on mymachine. Alternatively, you can define the -display argument to an individual X application, e.g.
      xterm -display mymachine:0 (on remotemachine)
Obviously, the reverse applies if you want to display X applications running on your machine to display remotely.

Telnet to the machine next to you and have it open an xterm on your machine. (You will need to use the xhost + <remotehostname> command to give the remote machine permission to display on yours.)

previous contents up next