What is X?

Discover the versatility and power of the X Window System

Download the whole article as PDF

Write a full post in response to this!


Everyone likes pretty pictures. The newsagent’s stand is now crowded with glossy magazines, roadside advertisements glare out at you as you drive along the freeway, you see a wondrous mosaic as you look at all the packaging on supermarket shelves. Television long ago replaced the radio as standard home entertainment and the fact that you cannot judge a book by its cover doesn’t prevent the vast majority of the human population from doing so. The same applies to computers now. The GUI (Graphical User Interface) or “windows functionality” has become part of the machine that everyone now takes for granted.

=IMAGE=x1shelf.jpg=

To sell something to the public it needs to look good

Any home or client system software provider, free or otherwise, that wants to be taken seriously has to provide a graphical user interface (GUI) as theirprime method of user interaction. Microsoft include theirs as part of the main system, or kernel, as do many other system providers. Most GNU/Linuxdistributions include it in the default install. However, with GNU/Linux and other POSIX operating systems, the GUI infrastructure is not part of the kernel but a separate program with the mystical name of “The X Window System”. It calls itself “X11 Release 6” and everyone else simply knows it as “X”. There’s a lot more to this X than meets the eye, it has attributes and powers that are not well known and can do things that other windowing systems cannot. What is this X? What amazing super-GUI powers does it have? This article attempts to tear off its mask and reveal all.

What is X?

A more appropriate question to “What is X?” is “What is X not?”. X is not actually a GUI. The GUIs in GNU/Linux tend to be GNOME, or KDE or even MOTIF. Most GNU/Linux distributions are now delivered with a GUI configured as the default interface, and this can compare with any other computer system’s GUI. And the end user, who processes words in documents, calculates sheets in spreads, mails e’s in readers, browses the surf in webs and the such, need not know the technical ins and outs of it. However, there is a lot more that can be done with a small amount of know-how and a bit of command manipulation…

So then what exactly is X if not a GUI? X is an infrastructure that a GUI uses to do its stuff. For example, a GUI handles the buttons,text and combo boxes, windows etc., whereas X handles the low level drawing of fonts, lines and pictures on the screen and accepts keyboardand mouse inputs as well as the inter-program communication of these. It can also handle network distribution of users and remote sessions.

X is not a GUI—it is an infrastructure that a GUI uses

One of the most confusing aspects of X is the naming of the parts, in that the terms “server” and “client” are the opposite of what many would expect. An X server is the screen and keyboard, what a lot of MS Windows people would automatically think of as the ultimate client. An X client is a program that opens and uses windows, such as a browser, email client, word-processor and so on. To go into why this is so I will compare an X-server to a file server…

A file server is a machine on a network where files exist and other machines, or clients, can connect to it to open, read, write or manipulate files. Often, of course, the file server and the client is the same machine, but sometimes it isn’t. What a file server is serving is data in files.

The concept of a file server tends to be well understood
The concept of a file server tends to be well understood

An X-server is a machine on a network where a “windowing” program exists and other machines, or X-clients, can connect to it and create windows, write or display text, pictures and so on, into a window and can read any input the user makes to that window. The X-clients are often run on the same machine, but sometimes they aren’t. What an X-server is serving is windows and your input.

=IMAGE=x1xserver.jpg=

The concept of an X-server is really no different to that of a file server

I will go through a detailed example of exactly what I mean. However, before commencing it is worth pointing out what follows is not how X is usually run. I am simply demonstrating some individual components to show how the infrastructure hangs together. First though, to install X…

If you have a GNU/Linux system you almost certainly have X already installed. To run through these below examples it is best to switch the GUI off initially if it is on. To do this go to the main virtual console by pressing CTRL-ALT-F1, logging in as root then enter the command “init 3”, then log out of root and log in as your user.

If you have a Windows system you can install the Cygwin version of X. Go to www.cygwin.com, click on the “install now” icon, follow the defaults. When the list of packages come up ensure the “X11” is marked as “Default” install. When installed double click on the Cygwin icon (or navigate to it through the “Start” menus) to get the “$” prompt.

The X server can be started manually at the command line; this can be done if X is not already running by simply entering:

X &

(X in capitals then an ampersand) at the dollar prompt. This will start an X-server in the background. On GNU/Linux this will be in a “virtual screen”, on Windows this will be in its own MS-Window. A black or gray patterned screen will appear with a plain graphical “X” in the middle that can be moved around by the mouse. This as it stands is totally useless—yup, a complete waste of time. Although you can move that X about by playing with the mouse, pressing keys and clicking on mouse buttons do nothing and it doesn’t even look pretty. This is like a formatted file server but with no files in it, interesting from a geeky point of view, has great potential, but currently not much to see.

=IMAGE=x1xblank.jpg=

An X-server running by itself—as such quite boring

Note: on MS-Windows and Cygwin, if you would rather use the entire screen to gain the “proper” X experience then add the “-fullscreen” option to the “X” command. Pressing the MS-Windows key (the one with the logo on it) will get you back to MS-Windows.

After the X-server has been started go back to the console where you entered the command (CTRL-ALT-F1 on GNU/Linux, or select the Cygwin window on MS-Windows), and enter the new commands:

xauth add :0 . `mcookie`
Don't miss out on the other pages!
1234567next ›last »

Write a full post in response to this!

Similar articles

0

Do you like this post?
Vote for it!

Copyright information

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html.

Biography

Edward Macnaghten: Edward Macnaghten has been a professional programmer, analyst and consultant for in excess of 20 years. His experiences include manufacturing commercially based software for a number of industries in a variety of different technical environments in Europe, Asia and the USA. He is currently running an IT consultancy specialising in free software solutions based in Cambridge UK. He also maintains his own web site.

admin's picture

Comments from the old system

Submitted by admin on Thu, 2006-03-30 14:40.

Vote!
0

From: Haakon
Url: http://far.no/
Date: 2006-01-22
Subject: NX would be a nice addition

It would be nice if the article included NX technology, which compresses and caches the SSHed X-session, thus making it workable over the Internet. NX is GPLed, and allows printing and sound, much like CITRIX or RDP.

On GNU/Linux, the SSH service can use a Pluggable Authentication Module (PAM) to pass the authentication of users and location of home directories to a directory service like OpenLDAP.

Once the SSH-session is authenticated and the home directory mounted, your users can work with their regular desktops over the Internet. They need an NX client installed, or you must provide the NX Java applet.

References:

* FreeNX - the free NX, http://freenx.berlios.de/

* NoMachine - the creators of NX, http://www.nomachine.com/

From: Robert Pogson
Url: http://www.skyweb.ca/~alicia
Date: 2006-02-24
Subject: FreeNX

The NXs still do not have a version for AMD64 which keeps me from running it on my Linux terminal server. The 64 bit version should be working this year.

From: Mojo
Url:
Date: 2006-02-25
Subject: Excellent introduction to X

Would just like to say thank you for an excellent introduction to X. It may not be something for the real newbies but this article has breadth and depth without being too long. A great article for intermediates like myself. Cheers!

From: Bugfunder
Url:
Date: 2006-02-28
Subject: No mention of vncviewer and via

On page 10:

ssh myuser@centralbox.com

indeed,

vncserver :1

indeed,

and then:

exit or ^D to exit, and from the local terminal:

vncviewer -via myuser@centralbox.com localhost:1

and that's it, type the password and work.

No explicit redirects, no login scripts, just work...

Anonymous visitor's picture

The last comment which

Submitted by Anonymous visitor on Thu, 2006-10-05 19:43.

Vote!
0

The last comment which mentioned the -via option was very useful. Is there any way to use it through a web browser?

Tug Ozbay's picture

How to run Xterm with -display so it xterms to host executing

Submitted by Tug Ozbay (not verified) on Tue, 2007-12-18 18:02.

Vote!
0

I have tried something like :-

/usr/bin/xterm -T `hostname` -display :0 -fg blue -fs 6 -e xyz

but want to know how it a script with the contents above will guess the ip of the host that connects to it, and sets up the display accordingly to enable an xterm !