The command to start X Window is "startx". When X starts up it reads the file /etc/X11/XF86Config-4 or /etc/X11/xorg.conf (depending on which version of X you're running). Inside this file things like the type of video card you have, the type of keyboard, the type of mouse, etc. are defined. Let's look at /etc/X11/xorg.conf now. (Open /etc/X11/xorg.conf)
If you (or your distros setup scripts) have configured X correctly, then X starts up and it reads the file .xinitrc in your home directory. In this file you specify what programs you want to execute when X starts up. Usually this would be the desktop environment of your choice (Gnome, KDE, etc.) In fact, if you don't have a .xinitrc file, your distro usually has a default desktop specified and it will automatically start that desktop environment for you. (note: this whole mechanism can be substituted or appended to by one of the graphical login managers (gdm, kdm) which allow you to select your favorite desktop and save that information for you in their own specific way). You can start any other programs you'd like in your .xinitrc as well. When the last program specified in this file exits, X will exit and you'll return to the bash prompt. I tend to be a minimalist and I login from the command line every time, so lets look at my .xinitrc for a simple example.
xsetroot -solid dodgerblue4 xscreensaver& icewmThe first line sets the background color / pattern for X. The second line starts the xscreensaver daemon. Notice that there is an ampersand after this line. This, of course, tells this program to execute in the background. If this program didn't background itself, then the desktop manager wouldn't start until xscreensaver exited. Also notice that the first line didn't have an ampersand. This is because the nature of xsetroot is to set the background and exit. The last line starts my favorite window manager icewm. Notice that without the ampersand X will stay running until I tell icewm to exit.
![[logo]](logo.png)