The X Window System

What is X?

X is a windowing system invented almost 20 years ago. X is by no means a GUI, although it provides a rudimentary framework that a GUI can be based on. X by itself does not do anything, it merely provides a framework for other applications to work with. Normally, a window manager runs on top of X, and the window manager is (among other things) responsible for managing windows (duh), starting new applications (xterm, netscape, etc.), and is responsible for the general look and feel of the desktop. This is why you can have an X desktop that looks like a Mac, Windows or just about anything you want.

How do I start X?

Assuming X is installed on your system, you can run the command startx, and this will start X with the default configuration. You must, of course, have startx in your path. Usually, startx is located in /usr/X11R6/bin.

What files get read when I run startx?

Normally, when you run the command startx, the file $HOME/.xinitrc is read. This is a simple shell script that gets executed (although you don't need to have the #!/bin/sh at the top, or even have it executable). This is the first file that you can use to start the window manager of your choice. Here is a very simple $HOME/.xinitrc:

/usr/X11R6/bin/xterm &

THis starts an xterm and the twm window manager. Notice that the xterm line has an ampersand after it, and the twm line doesn't. The ampersand starts the command in the background. Since the twm line doesn't have one of these, your X session will end when you quit twm. You want to always make sure that the last line in your .xinitrc doesn't have an ampersand after it.