If you’re a Linux or other Unix user on the desktop, you probably use the X Window System every day without thinking about it a whole lot. But if you understand - really understand - a little more about how it works, you can take advantage of some powerful features of this networked graphics system.

No matter which desktop environment or window manager you’re using, you can take advantage of the fact that X was built for a network and serves as the groundwork for some of the most varied graphical user interfaces out there. On what other system could you switch between a desktop that looks more like a traditional Mac or Windows setup to a tiling window manager in the blink of an eye, all while running a display from a program running on another computer? In that regard, X Window is pretty unique. So, let's get to know X Window a little better. (For background reading, see A Guide to Window Managers and Desktops for Unix and Linux.)

The History Behind the X Window System

While the modern X Window System has a lot of widespread use in the Linux and Unix community and supports some slick graphical environments, it’s actually been around since the 1980s. It emerged in the early part of that decade as part of Project Athena at MIT, an early attempt at distributed computing. The project developed many innovations that we take for granted today, including Kerberos authentication, instant messaging and online help, among others.

X was a follow-up to an earlier windowing system, W (which ran on the V operating system, naturally). It was formally introduced to the Project Athena community in 1984.

A number of Unix workstation vendors seized upon it immediately. If there was a standard interface for graphical user interfaces, then it would attract more software developers, along with more users and, most importantly, more paying customers. They formed the X Consortium to make sure that one company didn’t gain an advantage over the other. It’s an early example of open source software, even before this type of software had a name.

Version 11 was released in 1987, and it’s still the one used today. It’s known colloquially as "X11."

By the late 1980s, X was the de facto standard windowing environment on Unix workstations from vendors like Sun and Silicon Graphics.

In the 1990s, a version that ran on PCs called X386 became popular on desktops, especially the open source variant called XFree86. Around 2004, disagreements emerged in the project, and some developers split off to X.org, which became the standard implementation of the X Window System. X.org is the version shipped by almost all the major Unix and Linux distributions.

How X Window Works

Unlike other systems, including Windows and Mac OS X, where the graphical user interface is an integral part of the operating system, X, much like other Unix infrastructure, is actually just another program. In fact, it's common for servers to be run without X in order to devote more cycles to actually serving up resources, including databases or Web pages.

The X Window System has a layered architecture based around servers and clients. Where you might think of a server as something on a remote machine, such as a file server across the hall serving up files for a department, if you’re using X on a desktop, you’re actually using a server. The graphical programs running under X are the clients. They can be either local or running on a remote system. I’ll cover how to do that later in this article.

Window Managers and Desktop Environments

I’ve covered window managers and desktop environments in another article, but here they illustrate how flexible X is. X itself is not a full graphical interface. It leaves the choice of interface style completely up to the user, even if Linux distribution maintainers set a default environment. This was a deliberate choice on the part of the designers. Mike Gancarz, author of "The Unix Philosophy" and a member of the original X team, said this was setting "mechanism, not policy."

Getting X

If you use Linux and Unix on the desktop, you most likely have it and are using it already. If you aren’t, your distribution’s package manager has it, as well as any desktop and window manager you may desire. Consult the documentation for more details.

There are other platforms besides Linux, if you haven’t noticed, and X is available for them as well. For Windows, your best bet is Cygwin/X. Mac OS X also comes with X11 as an optional install.

Configuring X Window System

If you’re installing X on a system that doesn’t have it, most modern installations are smart enough to be able to automatically detect your video hardware, as well as the pointing device you’re using. Of course, there are always outliers. On the X.org server, the configuration file is called xorgconfig. There you can edit it to tell it exactly what kind of hardware you have. It’s not always a task for the faint of heart, but fortunately it's unlikely that you'll actually have to do it.

Using X Over the Network

One of the X Window System’s greatest strengths is its network transparency, which means you can run a program on another computer and have its display show up on your machine.

One way to do this is to SSH into the machine you want to the program to run, using the -X or -Y switch on the command line to turn on X forwarding, which will allow X programs to show up on your local computer. You or the administrator of the remote machine will have to enable this. You won’t get any fancy desktop options, but it works well enough. It’s a good way to get graphical software without having to install it on each user’s machine, regardless of whether you're using open source or expensive programs with site licenses, like Wolfram’s Mathematica. (Find out more about SSH in Mosh: Secure Shell Without the Pain.)

If you really need a desktop, you can use virtual network computing (VNC) to forward the entire desktop to your computer. It’s available on a wide variety of platforms. You could even have a Linux desktop on a Windows machine, or vice versa.

Questions About X Window System and Obsolescence

Despite its usefulness, some people think X might be nearing the end of its useful life. The networking part of the X standard is accused of slowing it down, especially when it comes to gaming. If it was faster, it might attract more game development to the platform.

In response to these claims, the Wayland project has sprung up to create a display server that can talk to the hardware directly without going through X. It’s already reached 1.0 stage, although it’s nowhere near ready for prime time, even if it has some fairly impressive demos. Canonical has also announced that it will move to Wayland at some point in the future.

The Future of X

Even though X is an overlooked part of the computing world, its flexibility and portability will mean it will be a part of Unix and Linux for quite some time. If you’re interested in getting deeper into X, Chris Tyler’s "X Power Tools" is a treasure trove of tips and tricks.