- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Starting X11 with the startx Command
The startx command is an easy way to start an X session if you're working on a single computer or boot Linux to runlevel 3 mode (X11, multiuser and networking enabled). There are other ways to start X (see the section Using xdm later in this chapter). The startx command is a handy shell script that will pass on command-line options to the X server for your X sessions.
The startx command is typically used to pass starting color-depth information to the X server, as well as to find client commands or options to run for the session (usually your .xinitrc file in your home directory; see the section The .xinitrc File).
If you use a similar Screen definition as in the previous section, the default X session will use 256 colors when you start your X session like this:
# startx
If your video card and monitor support a greater color depth, you can start a 16 bitplanes-per-pixel (thousands of colors represented by 16 bits per pixel) X session using the -depth command-line option like this:
# startx -- -depth 16
Unless you've used the DefaultColordepth option in your system's XF86Config file to set a specific color depth, using startx by itself will usually start an X session using 8-color bitplanes or 256 colors. Color values typically passed with the -depth option also include 24 and 32 for millions of colors.
Using the Console and Multiple X Sessions
You can also use startx to start multiple X11 sessions on the same computer, possibly using different window managers, and then navigate between the sessions using virtual consoles. Red Hat Linux supports up to six different login screens or consoles, accessed by pressing Alt+FX, where X is F1 through F6.
For example, if you log into Linux using a text-only console, you'll be at the first virtual console. After you log in, press Alt+F2; you'll then see another login prompt at the second console. To get back to your first login, press Alt+F1.
When you log into Linux and start an X11 session with startx, X uses a seventh virtual screen. Since you've started X from the first virtual console, this console will be unavailable for use. However, you can get to another virtual console, such as the second, by pressing Ctrl+Alt+F2 while in X11. You'll then see the Red Hat Linux login prompt. To go back to your X session, press Alt+F7. Using this approach, you can jump back and forth between your X session and different text consoles.
To use multiple X11 sessions at different color depths on different virtual consoles, first start a session with the startx command. After the X desktop appears, press Ctrl+Alt+F2 and log in to Linux again. If your graphics card supports thousands of colors again, use the startx command to start an X session. This time, however, include the :1, -fbbpp 16, and vt8 command-line options:
# startx -- :1 -depth 16 vt8
The screen clears and you'll be running an X session with a different color depth! To jump to your other X11 session, press Ctrl+Alt+F7. To jump to another virtual console, press Ctrl+Alt+F3 (since the first and second consoles are in use). To jump back to your original X session, press Ctrl+Alt+F8.
The .xinitrc File
When you use the startx command to initiate an X session on your computer, details about which window manager to use or other X clients to start can be found in a file called .xinitrc in your home directory. A sample or template file called xinitrc is installed in the /etc/X11/xinit directory. You can copy this file to your home directory with the filename .xinitrc and modify it.
Although the default .xinitrc file contains shell script logic to load system resources or set different environment variables, you can define a simpler version from scratch, such as the one in Listing 4.2, which can be used to start 12 different X window managers. (For more information about several X window managers included on this book's CD-ROMs, see Chapter 5.)
Example 4.2. Sample .xinitrc File
# Sample .xinitrc file # # This .xinitrc file has configuration support for the following X11 # window managers: AnotherLevel, fvwm, fvmw2, KDE, twm, mlvwm, AfterStep # WindowMaker, wm2, wmx, mwm, GNOME # # Use AnotherLevel's configuration of the fvwm2 window manager # fvwm2 -cmd 'FvwmM4 -debug /etc/X11/AnotherLevel/fvwm2rc.m4' # # Use fvwm2 # fvwm2 # # Use fvwm # fvwm # # Use the K Desktop Environment startkde # # Use twm - note: no longer needs an X terminal started! # twm # # Use the mlvwm (Macintosh-like) window manager # mlvwm # # Use AfterStep # afterstep # # Use WindowMaker # exec wmaker # # Use the wm2 window manager # wm2 # # Use the wmx window manager # wmx # # Use Motif's or LessTif's mwm # mwm # # Use GNOME # exec gnome-session
Note that the sample .xinitrc file in Listing 4.2 is currently set to use the K Desktop Environment. To use a different window manager (if installed on your system), add or remove the appropriate pound sign in the file; then use the startx command to start a new session:
# startx
Using xdm | Next Section

Account Sign In
View your cart