Table of Contents for
Running Linux, 5th Edition

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Running Linux, 5th Edition by Matt Welsh Published by O'Reilly Media, Inc., 2005
  1. Cover
  2. Running Linux, 5th Edition
  3. Preface
  4. Organization of This Book
  5. Conventions Used in This Book
  6. Using Code Examples
  7. How to Contact Us
  8. Safari® Enabled
  9. Acknowledgments
  10. I. Enjoying and Being Productive on Linux
  11. 1. Introduction to Linux
  12. 1.1. About This Book
  13. 1.2. Who’s Using Linux?
  14. 1.3. System Features
  15. 1.4. About Linux’s Copyright
  16. 1.5. Open Source and the Philosophy of Linux
  17. 1.6. Sources of Linux Information
  18. 1.7. Getting Help
  19. 2. Preinstallation and Installation
  20. 2.1. Distributions of Linux
  21. 2.2. Preparing to Install Linux
  22. 2.3. Post-Installation Procedures
  23. 2.4. Running into Trouble
  24. 3. Desktop Environments
  25. 3.1. Why Use a Graphical Desktop?
  26. 3.2. The K Desktop Environment
  27. 3.3. KDE Applications
  28. 3.4. The GNOME Desktop Environment
  29. 3.5. GNOME Applications
  30. 4. Basic Unix Commands and Concepts
  31. 4.1. Logging In
  32. 4.2. Setting a Password
  33. 4.3. Virtual Consoles
  34. 4.4. Popular Commands
  35. 4.5. Shells
  36. 4.6. Useful Keys and How to Get Them to Work
  37. 4.7. Typing Shortcuts
  38. 4.8. Filename Expansion
  39. 4.9. Saving Your Output
  40. 4.10. What Is a Command?
  41. 4.11. Putting a Command in the Background
  42. 4.12. Remote Logins and Command Execution
  43. 4.13. Manual Pages
  44. 4.14. Startup Files
  45. 4.15. Important Directories
  46. 4.16. Basic Text Editing
  47. 4.17. Advanced Shells and Shell Scripting
  48. 5. Web Browsers and Instant Messaging
  49. 5.1. The World Wide Web
  50. 5.2. Instant Messaging
  51. 6. Electronic Mail Clients
  52. 6.1. Using KMail
  53. 6.2. Using Mozilla Mail & News
  54. 6.3. Getting the Mail to Your Computer with fetchmail
  55. 6.4. OpenPGP Encryption with GnuPG
  56. 7. Games
  57. 7.1. Gaming
  58. 7.2. Quake III
  59. 7.3. Return to Castle Wolfenstein
  60. 7.4. Unreal Tournament 2004
  61. 7.5. Emulators
  62. 7.6. Frozen Bubble
  63. 7.7. Tux Racer
  64. 8. Office Suites and Personal Productivity
  65. 8.1. Using OpenOffice
  66. 8.2. KOffice
  67. 8.3. Other Word Processors
  68. 8.4. Synching PDAs
  69. 8.5. Groupware
  70. 8.6. Managing Your Finances
  71. 9. Multimedia
  72. 9.1. Multimedia Concepts
  73. 9.2. Kernel and Driver Issues
  74. 9.3. Embedded and Other Multimedia Devices
  75. 9.4. Desktop Environments
  76. 9.5. Windows Compatibility
  77. 9.6. Multimedia Applications
  78. 9.7. Multimedia Toolkits and Development Environments
  79. 9.8. Solutions to Common Problems
  80. 9.9. References
  81. II. System Administration
  82. 10. System Administration Basics
  83. 10.1. Maintaining the System
  84. 10.2. Managing Filesystems
  85. 10.3. Managing Swap Space
  86. 10.4. The /proc Filesystem
  87. 10.5. Device Files
  88. 10.6. Scheduling Recurring Jobs Using cron
  89. 10.7. Executing Jobs Once
  90. 10.8. Managing System Logs
  91. 10.9. Processes
  92. 10.10. Programs That Serve You
  93. 11. Managing Users, Groups, and Permissions
  94. 11.1. Managing User Accounts
  95. 11.2. File Ownership and Permissions
  96. 11.3. Changing the Owner, Group, and Permissions
  97. 12. Installing, Updating, and Compiling Programs
  98. 12.1. Upgrading Software
  99. 12.2. General Upgrade Procedure
  100. 12.3. Automated and Bulk Upgrades
  101. 12.4. Upgrading Software Not Provided in Packages
  102. 12.5. Archive and Compression Utilities
  103. 13. Networking
  104. 13.1. Networking with TCP/IP
  105. 13.2. Dial-Up PPP
  106. 13.3. PPP over ISDN
  107. 13.4. ADSL
  108. 13.5. Cable Modems
  109. 13.6. Network Diagnostics Tools
  110. 14. Printing
  111. 14.1. Printing
  112. 14.2. Managing Print Services
  113. 15. File Sharing
  114. 15.1. Sharing Files with Windows Systems (Samba)
  115. 15.2. NFS Configuration and NIS
  116. 16. The X Window System
  117. 16.1. A History of X
  118. 16.2. X Concepts
  119. 16.3. Hardware Requirements
  120. 16.4. Installing X.org
  121. 16.5. Configuring X.org
  122. 16.6. Running X
  123. 16.7. Running into Trouble
  124. 16.8. X and 3D
  125. 17. System Start and Shutdown
  126. 17.1. Booting the System
  127. 17.2. System Startup and Initialization
  128. 17.3. Single-User Mode
  129. 17.4. Shutting Down the System
  130. 17.5. A Graphical Runlevel Editor: KSysV
  131. 18. Configuring and Building the Kernel
  132. 18.1. Building a New Kernel
  133. 18.2. Loadable Device Drivers
  134. 18.3. Loading Modules Automatically
  135. 19. Text Editing
  136. 19.1. Editing Files Using vi
  137. 19.2. The (X)Emacs Editor
  138. 20. Text Processing
  139. 20.1. TeX and LaTeX
  140. 20.2. XML and DocBook
  141. 20.3. groff
  142. 20.4. Texinfo
  143. III. Programming
  144. 21. Programming Tools
  145. 21.1. Programming with gcc
  146. 21.2. Makefiles
  147. 21.3. Debugging with gdb
  148. 21.4. Useful Utilities for C Programmers
  149. 21.5. Using Perl
  150. 21.6. Java
  151. 21.7. Python
  152. 21.8. Other Languages
  153. 21.9. Introduction to OpenGL Programming
  154. 21.10. Integrated Development Environments
  155. 22. Running a Web Server
  156. 22.1. Configuring Your Own Web Server
  157. 23. Transporting and Handling Email Messages
  158. 23.1. The Postfix MTA
  159. 23.2. Procmail
  160. 23.3. Filtering Spam
  161. 24. Running an FTP Server
  162. 24.1. Introduction
  163. 24.2. Compiling and Installing
  164. 24.3. Running ProFTPD
  165. 24.4. Configuration
  166. IV. Network Services
  167. 25. Running Web Applications with MySQL and PHP
  168. 25.1. MySQL
  169. 25.2. PHP
  170. 25.3. The LAMP Server in Action
  171. 26. Running a Secure System
  172. 26.1. A Perspective on System Security
  173. 26.2. Initial Steps in Setting Up a Secure System
  174. 26.3. TCP Wrapper Configuration
  175. 26.4. Firewalls: Filtering IP Packets
  176. 26.5. SELinux
  177. 27. Backup and Recovery
  178. 27.1. Making Backups
  179. 27.2. What to Do in an Emergency
  180. 28. Heterogeneous Networking and Running Windows Programs
  181. 28.1. Sharing Partitions
  182. 28.2. Emulation and Virtual Operating Systems
  183. 28.3. Remote Desktop Access to Windows Programs
  184. 28.4. FreeNX: Linux as a Remote Desktop Server
  185. A. Sources of Linux Information
  186. A.1. Linux Documentation Project
  187. A.2. FTP Sites
  188. A.3. World Wide Web Sites
  189. About the Authors
  190. Colophon
  191. Copyright

The GNOME Desktop Environment

The GNOME desktop environment, like KDE, is a complete desktop suite, from the desktop background up to a set of applications. As with KDE, GNOME can run any X application, and both KDE and GNOME rely on standards set by the Freedesktop.org group. In fact, the distinction between the two desktops is, in many ways, of interest more to developers choosing toolkits than to users, who in most cases mix and match applications without having to worry about the underpinnings.

The primary goals of the GNOME project are simplicity and ease of use. Applications must comply with extensive human interface guidelines to become part of the official GNOME desktop. Because GNOME makes an excellent platform for development in C, C++, Python, Java, and C#, unofficial and third-party applications are numerous. In some cases (notably the XML system), GNOME libraries appear in command-line and server-based applications.

Of course, for our purposes, the interesting parts are the core desktop and its associated applications. In the following sections, we go over the GNOME look and feel, talk a little bit about the customization options it offers to you, and then give a quick tour of major applications, such as Evolution and Nautilus.

Most Linux distributions include GNOME, but if you haven’t installed it yourself, or if you want a newer version, you can visit http://gnome.org or your distribution’s web page for downloads.

Core Desktop Interface

The GNOME desktop is designed to be familiar to anyone who has used a computer before. Although you can change the settings in almost any way, a typical installation will have a desktop with icons on it and a panel along the top and bottom. The panels are among the most important GNOME tools because they are so versatile and they allow a wide range of interactions with your system. Panels can exist along one edge of your screen, like the Windows control panel; along a portion of it, like the Macintosh Dock, and more. They can contain buttons to launch applications and small applications called applets such as clocks, system monitors, and even tiny games.

Basic GNOME tasks

Here is a quick explanation of how to perform the most common tasks . Once you get the hang of these, you can probably guess how to do anything else.

Open or activate an item in the panel

Click once with the left button.

Start a program

Buttons known as launchers cause a program to open when left-clicked; GNOME desktops typically have such buttons both in panels and on the desktop. Furthermore, when you click on a file, an appropriate program opens that file, as described shortly.

Move items around on the desktop

Click and drag with the left mouse button.

Move items in the panel

Clicking and dragging with the left mouse button works for launchers, but for some applets, the left mouse button is used to control the applet. In that case, middle-click and drag. This is also the case for moving windows by their borders—left-click will expand the window, but middle-click lets you move it.

Organize items on the desktop

Right-click the desktop background and select Clean Up by Name. Items will be arranged in alphabetical order, with two exceptions: the first item, in the upper left, is always your home directory, and the last item in the list is always the Trash folder.

Open or activate an item on the desktop

Double-click it. If you double-click a folder icon, it opens the folder in the Nautilus file management tool. If you double-click a spreadsheet document, the Gnumeric spreadsheet starts up and opens the document. If you have a window open and Shift-click or middle-click a folder in it, the current folder will close as a new one opens in its place.

Get a list of options or set preferences for any object

Click with the right mouse button to get a menu of available options for any object. For example, you can change the desktop background by right-clicking the background and choosing Change Desktop Background. More general preferences are available in the GNOME Control Center, which you can access by choosing System Personal Settings or Applications Desktop Preferences, or by typing gnome-control-center at the command line. The exact menu arrangements may vary slightly depending on your distribution and version.

Paste text into any text area

As with other operating systems, Ctrl-C copies, Ctrl-X cuts, and Ctrl-V pastes in every application except Emacs and XChat. You can also use the more traditional Unix mode pasting by selecting any text and then middle-clicking.

The panel

The preset configuration for many systems has a thin panel along the top and bottom of the screen. The top panel has a set of menus along the upper left, and a few buttons and a clock at the right. The bottom panel contains the window list applet, which should feel familiar to Microsoft Windows users; it displays a list of all open windows so you can switch applications easily.

To create a new panel, click any blank space in an existing panel, and choose Panel Create New Panel, then select the type of panel you would like. To change a panel’s properties, such as its size and color, right-click it and choose Properties (the menu panel at the top of the screen has no available properties; it is preconfigured for one position and size). Experiment with different kinds of panels and with different sizes to see which ones you like best. If you use a smaller screen, such as a laptop screen, you will want to choose a smaller panel size than if you have plenty of screen real estate to use.

To add application launcher buttons to your panels, you can drag them from menus, or right-click the panel and choose Panel Add to Panel Launcher. Then, enter the name of the application you want to run, and choose an icon. You may also choose a description of the launcher that will display as a tool tip when you hover the mouse over the icon in your panel. If you want to launch the application from a terminal, check the “Run in Terminal” box.

For more information on the panel, right-click any empty spot in the panel and select Panel Panel Manual.

Panel applets are small applications that run inside the panel. You can add them to the panel from the Add to Panel menu or just run them by clicking Applications Applets. Panel applets come in a bewildering variety of flavors, from games to utilities. Some of the most common are the following:

Notification Area

The notification area is similar to the Windows system tray and holds a variety of system status displays. Applications such as the Gaim instant messenger tool (described in “Instant Messaging” in Chapter 5) and the Rhythmbox music player use it as a control area that allows users to access them without keeping any windows open. System alerts and print queues will also display in this area. Both KDE and GNOME make use of the same notification area system, so applets that use the notification area will work in both desktops.

Netapplet

Netapplet runs in the notification area and allows you to browse and choose available wired and wireless network connections. This is particularly useful for laptop users who need to use Wi-Fi (802.11x) connections. To run Netapplet, you must also be running netdaemon.

System Monitor

A graph that displays the load on your system resources for the past few seconds. To get a more detailed system report, including a list of all running processes and applications, right-click on the applet and select Open System Monitor.

Workspace Switcher

In most installations, this applet will already be running when you log in, and is typically set to four workspaces. Each workspace is the equivalent of a new screenful of desktop space, and you can have as many as you like. The workspace switcher displays all the virtual workspaces you have created, and displays each window on the desktop as a tiny box. You can use the left mouse button to drag a window from one workspace to another. Right-click and select the Properties menu item to change the number or arrangement of workspaces.

Window List

Like the workspace applet, the Window List is included in most default configurations. It displays the windows that you have open so that you can switch easily among them, even when they are minimized. If you have multiple windows for a single application, they will be grouped under a single entry. To turn this feature off, or to set other options for the applet, right-click the Window List and select Properties.

Battery Charge Monitor

The Battery Charge Monitor displays the remaining battery life for laptop systems. You can also use the Battery Charge Monitor to put your system into “sleep” or “suspend” mode by right-clicking on the applet and selecting Suspend Computer. Resuming operation from suspend mode is faster than rebooting, but the mechanism for operation will vary depending on your hardware and distribution. Older systems with the Advanced Power Management system use the command apm -s. Newer systems with ACPI support need to be sure that they have ACPI events configured properly in /etc/acpi/events/default, although your distribution will probably have a convenient GUI for this task. For both ACPI and APM, SUSE Linux uses powersaved, and the sleep command is powersave --suspend.

Nautilus: your desktop and file manager

Nautilus is the name of the GNOME desktop and file manager. It controls the display of your background image and the files on your desktop, allows you to interact with files without using a terminal, and keeps track of your trash for you. In other words, it’s the GNOME equivalent of Windows Explorer, the Macintosh Finder, and KDE’s Konqueror. Like those other applications, Nautilus lets you drag items from one place to another. You can also copy files using Ctrl-C, cut with Ctrl-X, and paste with Ctrl-V.

Tip

In most cases, Nautilus will be running when you log in. If you don’t want to run Nautilus at all, you can remove it from your session with the Session Properties tool in the Control Center. If you change your mind and want to start it, the command is nautilus.

The quickest way to get started with Nautilus is to double-click the home icon in the upper-left corner of your desktop, labeled as your home. This will open your home directory. Nautilus varies from other file management systems in that a window not only displays a folder, but is the folder: if you open a folder, then double-click it to open it again, it will merely raise the first window. For that reason, the location bar you may expect at the top of a window is not present. Instead, press Ctrl-L to enter a file location.

Tip

Experts and those familiar with other file management systems will appreciate that Nautilus, although simple at first look, has a variety of conveniences and shortcuts that make advanced use much quicker. The first is Ctrl-L, which works not only in Nautilus but in all GNOME-related file selection dialogs to allow you to type a filename instead of clicking to choose a file. In web browsers, you can also use Ctrl-L to enter a web page instead of selecting the location bar with the mouse.

Opening windows: To avoid opening several windows at once, Shift-click or middle-click to close the current window when opening a new one.

Shortcuts for places: The combination Alt-Up opens the parent of the current folder, and Alt-Home opens your home directory.

If you prefer a more complex file display, right-click on any directory and choose Browse Folder . Browse mode includes the location bar absent from the normal Nautilus display mode, and also includes the left-side pane. At the top of the left pane is a selector for different information displays:

Information

Displays basic information about the current folder.

Emblems

Displays a list of available emblems, small badges you can add to any file’s icon. Drag them from the side pane onto any file to mark it. For example, if you have several similar images in a folder, you might want to drag the “Cool” or “Favorite” emblem to remind you which one you like best. You can also set emblems by selecting Edit Background and Emblems.

History

Shows a list of previous locations you have displayed in Nautilus. Double-click any folder to return to it.

Notes

Allows a note to be kept on a particular folder. Each folder has a different page of notes.

Tree

Perhaps the most useful of the side-pane tools, this allows you to navigate a complex folder hierarchy with convenient spin-down triangles. Each folder in the tree is displayed with a triangle next to it; click the folder to open it, or click the triangle to display any subfolders without actually visiting the folder itself.

Some neat Nautilus features include the following:

  • Instead of a generic image icon for graphics files, Nautilus uses scaled-down thumbnails of the image itself. This makes it easy to organize directories full of images, such as those pulled from a digital camera.

  • If you hover your mouse over a music file, the file will begin to play.

  • For text files, the plain document icon is decorated by the actual text contents of the file. That way, you can remember how the file starts without having to open it, even if you didn’t give it the most descriptive name.

  • You can stretch icons by right-clicking them and choosing Stretch Icon. If you stretch a text icon enough, you can see the entire contents of the file, and use it as a desktop notepad.

  • Select Edit Backgrounds and Emblems to choose different emblems to decorate icons. You can also drag colors and patterns from this area to set your desktop and panel background. To set an image as the desktop background, right-click on the desktop and choose Change Desktop Background.

All in all, Nautilus is a versatile tool that you can learn to use just by poking around a little. For additional help, just choose Help and then Nautilus User Manual from any Nautilus window.

Expert Settings: GConf

GConf is a centralized, XML-based configuration system for desktop applications. It allows applications to share keyboard shortcuts, themes, and other preferences, and uses a daemon to notify applications when preferences change, so you don’t have to restart the application to see a change take effect.

GConf can also be used to lock down a desktop system with a finer degree of granularity than traditional Unix file locking. An administrator might wish to lock GConf settings to permit some, but not all, behavior for a given application, and allow some, but not all, changes in preferences. Administrators of kiosks, public computer labs, and other security- and support-conscious deployments find system lockdown to be indispensable. Therefore, most applications provide a lockdown section in their GConf files. If you have users you want to keep out of trouble, explore these options in greater detail. One good resource is the GNOME System Administrator’s Guide, available at http://www.gnome.org.

In this book, we assume that you’re not interested in locking preferences down, but in opening things up and tweaking them to your taste. That’s where gconf-editor comes in handy. You can, of course, edit the XML files in ~/.gconf yourself, but the gconf-editor application makes things a little more convenient.

To get started, run the command gconf-editor. On the left side of the window is the GConf hierarchy, arranged like a file tree starting at /. The tree corresponds to actual settings files stored in the ~/.gconf directory, so changing something in the /applications tree alters files stored in ~/.gconf/applications. On the right side of the window is the list of available settings, called keys, and a place for documentation about the selected key.

We’re mostly interested in items under the /apps tree. The /desktop and /GNOME trees hold information not tied to a specific application, such as session data and desktop-wide lockdown settings. Systemwide configuration is stored in /system, and information about the way GConf stores settings is kept in /schemas. Avoid changing anything in the /schemas tree.

For now, let’s try adjusting an application setting, to give you a feel for what can be done. Normally, the files on your desktop come from the ~/Desktop folder. However, you can force Nautilus to display your home directory on the desktop instead. Select /apps/nautilus/preferences/desktop_is_home_dir and check the box. Now, Nautilus will display the contents of your home directory on your desktop.

Other applications have similar “hidden” preferences you can change. Try the following:

  • Metacity window manager: Check the box in /apps/metacity/reduced_resources to make Metacity use as few system resources as possible. This will make it look less attractive, but may improve system performance.

  • Epiphany web browser: Normally, a middle click in the Epiphany web browser turns on the vertical scroll feature familiar to users of Internet Explorer. However, users of traditional UNIX browsers may prefer to check the box for /apps/epiphany/general/middle_click_open_url and turn on the “paste URL” feature. Select a URL in any application, then middle-click in a non-text-entry area of a web page, and Epiphany will load the text you have selected.