Starting the X Window System

We're now ready to start X! Let's begin. Starting the X Window System is easy. To start X, you only need to type commands at the shell prompt. First, make sure you are at the shell prompt, logged in and ready to go. You may already be in the X Window System; if this is the case, close out of it and reopen it to get the experience of loading it. Please note: If you are doing this at work and unsure of what you are doing, you may want to first ask for permission from your system administrator or whoever handles the administration of your system.

If you booted up your system and it went directly into X, this means that the system has been configured to do so automatically. If it didn't, you can configure it to load automatically if you like.

To start the X Window System manually after you log in, type the following:

						>startx
					

There are two primary ways to load X: either a shell script called startx (which is also known as x11 in some distributions) or the xinit program. Using startx will automate function calls to xinit, and thus is the preferred method to start X. In Lesson 14, “Shell Scripting Fundamentals,” we will cover shell scripting in more depth.

Now that you know how to start the X Window System, let's talk more about it and what you need to know about starting applications.

After the X server starts itself, you will need to start some X applications as well. There is a default set available upon boot-up. A file called .xinitrc is located in your home directory. When Unix boots up, .xinitrc is automatically executed. Although this file is common, not all versions of Unix use it. Here are some examples of files used in other versions:

  • Linux distributions use ****.m4 files.

  • IRIX will use a secondary proprietary means if .xinitrc does not load initially.

The .xinitrc File Goes by Other Names Just like many other things in Unix, there are variations in the name of the .xinitrc file in different distributions. Other known versions of this file include .Xinit, .xinit, .Xinitrc, or .xsession.

Remember, Unix is case sensitive, so having upper- and lowercase letters in your commands or switches can change the meaning of the command.


So what does an .xinitrc file look like? Here's an example:

#!/bin/sh
xrdb -load $HOME/.X11defaults
xscreensaver -timeout 10 &
xterm -geometry 80x30+10+10 &

An .xinitrc file, when dissected line by line, appears as follows:

  • Line 1 states to use the Bourne shell, sh.

  • Line 2 states to load the server resource database from the file .X11defaults in your home directory.

  • Line 3 states to start the command xscreensaver, assign a 10-minute timeout, and then place the process in the background.

  • Line 4 states to start an xterm (terminal), which is 80 characters wide by 30 characters high, placing it 10 pixels from the top and left of your screen.

The server resource database is discussed later in this lesson.

What's with the Ampersand? For all programs you run out of the .xinitrc file (except your controlling process), end the line with an ampersand (&). An ampersand will make sure that the program you specify is run in the background.


Now that you understand the basics of the X Window System, the xinit program, startx, and the .xinitrc file, let's tie it all together so it makes sense and so you can learn how to make configuration changes to your Unix environment. This way, you can become more comfortable while working in your Unix environment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.187.24