Preface

This is a straightforward, easy-to-read, logically organized book about GNU/Linux by an author who has been writing successful books on UNIX/Linux operating systems for more than 20 years. This book is a practical guide because it uses tutorial examples to show you how each command works, each step of the way. Your screen mimics what you see in the book as you learn about GNU/Linux in general and Redhat Linux version 8 in particular.

The book is uniquely designed for both beginners and experienced users, including introductory and more advanced chapters. Although this book targets Red Hat version 8, most of it applies to all GNU/Linux distributions.

Parts I and II of A Practical Guide to Red Hat Linux 8 show you how to

Part III is a reference guide to more than 85 GNU/Linux utilities. Part IV includes appendixes, a glossary, and the index.

You do not have to read this book in page order. Once you are comfortable using GNU/Linux, you can use this book as a reference: Look up a topic of interest in the table of contents or index and read about it. Or think of this book as a catalog of GNU/Linux topics: Flip through the pages until a topic catches your eye. This book has many pointers to Web sites where you can get additional information: Consider the Web as an extension of this book.

Red Hat Version 8

Red Hat version 8 release provides users and administrators (who are sometimes one and the same) with tools and an environment that make setting up, maintaining, and using a GNU/Linux system more straightforward than ever before.

Red Hat has wrapped the GNOME and KDE GUIs in its Bluecurve theme, making the two principal graphical desktop environments look and perform similarly. Under Red Hats setup, GNOME runs utilities designed for KDE, and KDE does the same with GNOME utilities. By providing a uniform environment and key tools that work across many platforms, Red Hat is working toward corporate acceptance of desktop GNU/Linux, which benefits all users. For the user who needs to communicate and exchange documents with users on other platforms, Red Hat 8 includes

For the system administrator, Red Hat Linux version 8 provides new configuration tools including

Also, by including the latest software and conforming to the LSB (Linux Standards Base) 1.2, Red Hat helps software developers focus on designing and implementing applications, not dealing with nonconformance issues.

Audience

This book appeals to a wide range of readers; it does not require programming experience, but some experience using any general-purpose computer is helpful. This book is appropriate for

Benefits

A Practical Guide to Red Hat Linux 8 gives you a broad understanding of many facets of GNU/Linux, from using it through customizing it. Whether you are a programmer/developer, a systems administrator, or an end user, this book gives you the knowledge you need to get on with your work: You will come away from this book understanding how to use GNU/Linux, and this book will remain a valuable reference tool for years to come.

Scope of Coverage

A Practical Guide to Red Hat Linux 8 covers a wide range of topics, showing you how to use Red Hat Linux from your screen and keyboard.

Experienced Users May Want to Skim Part I|| tip
If you have used a UNIX/Linux system before, you may want to skim over or skip some or all of the chapters in Part I. All readers should take a look at Conventions (page 24), which explains the typographic and layout conventions that this book uses, and Documentation (page 42) which points you toward both local and remote sources of GNU/Linux and Red Hat documentation.

The more advanced material in each chapter is presented in sections marked Optional, which you are encouraged to return to after mastering the basic material presented in the chapter. Review exercises are included at the end of each chapter for readers who want to hone their skills. Some of the exercises test your understanding of material covered in the chapter, whereas others challenge you to go beyond the material presented to develop a more thorough understanding. Answers to some exercises are at www.sobell.com.

Features by Chapter

  • The history and background of GNU/Linux (Chapter 1)
  • Conventions used in this book, how to log in on your system, and using the documentation systems (Chapter 2)
  • Basic utilities (Chapter 3)
  • The GNU/Linux filesystem structure (Chapter 4)
  • The (generic) shell (Chapter 5)
  • An introduction to GUIs, including the X Window System (Chapters 6)
  • The X Window System: use and customization (Chapter 6)
  • The GNOME 2 desktop environment (GUI interface, Chapter 7)
  • The KDE 3 desktop environment (GUI interface, Chapter 8)
  • Networks: concepts, terminology, and practical instructions for setting up a secure network (Chapters 9 and 17)
  • Secure utilities: ssh, scp, gpg, lokkit, and more (Chapter 9, Part III, and Appendix C)
  • The vim and emacs text editors (Chapters 10 and 11)
  • Using the shells interactively and as programming languages: the Bourne Again Shell—bash—(Chapters 12 and 13), the TC Shell—tcsh—(Chapter 14), and the Z Shell—zsh—(Chapter 15).
  • Programming tools: C, make, source code management—RCS and CVS—(Chapter 16)
  • System administration (Chapter 17)
  • More than 85 utilities, including many examples (Part III)
  • Appendixes covering
    • Regular expressions (Appendix A)
    • Finding software and pointers to useful Web pages (Appendix B)
    • Security: an overview of this important topic (Appendix C)
    • POSIX: standards that specify a standard UNIX/Linux (Appendix D)
    • GNUs Free Software Definition (Appendix E)
  • A comprehensive glossary of more than 500 words and phrases
  • A complete index

Features by Concept

  • Concepts illustrated by practical examples throughout
  • A security-conscious perspective: security boxes throughout the book noting where you can improve system security, including network security
  • Key topics with tutorials: pico, vim (vi improved), and emacs text editors; pine mail and news reader, and more
  • Resources for finding and installing software: Web sites, rpm, and the GNU Configure and Build System
  • Resources for finding online documentation—both local and on the Internet
  • Important GNU tools, including gcc, gdb, GNU Configure and Build System, gawk, gzip, and many others

Assistance

  • Many examples throughout
  • Comprehensive index
  • Caution boxes warning you of the consequences of taking certain actions
  • Security boxes alerting you to security issues
  • Tip boxes helping you avoid pitfalls
  • Help in obtaining online documentation from many sources including your local system, the Red Hat documentation CD-ROM, the Red Hat Web site, GNU, and other locations on the Internet
  • Many useful URLs (Internet addresses) where you can obtain software, security programs and information, and more

Tutorials

  • pico text editor
  • emacs text editor and programmers environment
  • vim (vi improved) editor
  • pine as a mail program
  • pine as a newsreader

Features by Topic

Red Hat Linux

  • A Practical Guide to Red Hat Linux 8 is based on Red Hat version 8, although much of it is compatible with other versions and distributions of GNU/Linux.
  • A complete chapter and more covers the GNU/Linux filesystem and Red Hats implementation: structure, types of files, links, pathnames, permissions, locations for common files, as well as utilities that change filesystems.
  • Red Hat has built and contributed to many tools for system administration, including rpm (Red Hat Program Manager), which makes it a simple matter to install or remove program packages; RHN (Red Hat Network), which can keep your system programs and files up-to-date automatically as well as install new ones; redhat-config-users (sets up users on the system); printconf-gui (configures printers); and many more.
  • A chapter each is devoted to the GNOME version 2 and KDE version 3 graphical desktops as configured by Red Hat with the Bluecurve theme.

Networking, the Internet, and the World Wide Web

Chapter 9 explains what a network is, how it works, and how you can use it. This chapter covers types of networks, various network implementations, distributed computing, using the network for communicating with other users, and using various networking utilities (such as ssh, scp, telnet, ftp, pine, host, and more).

  • Broad Internet coverage includes firewalls, network services, types of networks and their operation, network protocols, and IPv6.
  • Complete instructions are given on using free software: finding, downloading, and installing free software from the Internet, using a variety of tools.
  • Guidance is provided on using networking tools, including ping, host, dig, traceroute, swat (Samba), and more.
  • Distributed computing, including DNS, NIS, NFS, proxy servers, Internet services, and more, is also covered.

Organizing Information

Chapters 2, 3, and 4 explain how to create, delete, copy, move, and search for information by using GNU/Linux utilities. You also learn how to use the GNU/Linux file structure to organize the information you store on your computer.

Electronic Mail and Telecommunications

Chapters 2 and 3 and Part III include information on how to use utilities (pine, mail, talk, write) to communicate with users on your system and other systems. Chapter 9 details how to address electronic mail to users on remote, networked systems. Chapter 17 has a section on using sendmail.

The Shells

Chapter 5 introduces the concepts of standard input, standard output, redirection, pipes, background processes, filename generation, and builtin commands. It shows you how to redirect output from a program to a printer or a file simply by changing the command line. The chapter also demonstrates how you can use pipes to combine utilities to solve problems right from the command line.

Shell Programming (Shell Scripts)

Once you have mastered the basics of Red Hat Linux, you can use your knowledge to build more complex and specialized programs, using a shell as a programming language. Chapter 12 picks up where Chapter 5 leaves off, covering more advanced aspects of working with a shell, using for examples the Bourne Again Shellbash, the shell used almost exclusively for system shell scripts. Chapter 13 shows how to use bash to write scripts composed of GNU/Linux system utilities. Chapter 14 covers the TC Shell—tcsh, an improved version of Berkeleys C Shell. Chapter 15 covers the Z Shell—zsh, similar to the Korn Shell—extending the concepts of shell programming introduced in Chapter 13 into more advanced areas, including more information on the locality of variables, recursion, and the coprocess. The examples in Part III also demonstrate many features of the utilities you can use in shell scripts.

Job Control

The job control commands, which originated on Berkeley UNIX, allow you to work on many jobs at once from a single window and to switch back and forth between the jobs as desired. Job control is available under the three major shells.

Shell Functions

Shell functions available in the bash and zsh Shells enable you to write your own commands that are similar to the aliases provided by the TC Shell, only more powerful.

The X Window System and Graphical User Interfaces (GUIs)

Chapter 6 discusses the X Window System and how to open and control windows, customize your X work environment, and use some of the features common to GNOME and KDE. Chapter 7 covers GNOME and Chapter 8 covers KDE.

X Window System
  • Window managers
  • Bringing up and shutting down the X Window System
  • Setting X resources
  • Using the X Window System
  • Customizing the X Window System
  • Remote computing and local displays
GNOME Graphical Desktop
  • Main panel: control center of the GNOME desktop
  • Menus: the key to using GNOME, including details of the GNOME (Main) menu
  • Metacity window manager: how to use and customize this new, simple, compact window manager
  • Bluecurve theme: its icons and buttons
  • Nautilus file manager: the cornerstone GNOME utility, including the use of control bars and establishing properties
  • Start-Here window: an alternative way of setting preferences
  • GNOME utilities: search, terminal emulator, pick a font, pick a color, MIME types, and much more
  • Customizing GNOME: Nautilus, panels, and menus
  • Sawfish window manger: window operations, menus, and configurator
KDE Graphical Environment
  • Main panel (kicker): control center of the KDE desktop
  • Menus: the key to using KDE, including details of the K (Main) menu, Desktop menu and menubar, Taskbar, Window List menu, and Operations menu
  • Bluecurve theme: its icons and buttons
  • Konqueror browser and file manager: views, toolbars, find files, shortcuts, Navigation panel
  • Start-Here window: an alternative way of setting preferences
  • How to get help: Whats this?, KHelpcenter, Help menu
  • Window manager: using and modifying kwin
  • Customizing KDE: Control center, panels, toolbars, K Menu editor, autostart, and sound.

Utilities

Linux includes hundreds of utilities. Part III contains extensive examples of how to use many of these utilities to solve problems without resorting to programming in C or another language. The example sections of gawk (more than 20 pages, starting on page 1185), sed (page 1310), and sort (page 1326) give real-life examples that demonstrate how to use these utilities alone and with other utilities to generate reports, summarize data, and extract information.

Secure Utilities

Many newer utilities establish secure connections, encrypt data, and verify the identify of the creator/sender of files. Appendix C discusses security issues and solutions; Chapter 9 and Part III explain the use of secure utilities, including ssh, scp, and pgp.

The vim Editor

Red Hat Linux supplies the vim text editor, an improved version of vi. The vi editor was originally a part of Berkeley UNIX and is still one of the most widely used text editors. Chapter 10 starts with a tutorial on vim and goes on to explain how to use many of the advanced features of vim, including special characters in search strings, the general-purpose and named buffers, parameters, markers, and executing commands from vim.

The emacs Editor

Red Hat Linux supplies the popular GNU emacs editor. Chapter 11 includes information on emacs and the X Window System, allowing you to use a mouse and take advantage of such X Window System features as menus and cut-and-paste with emacs. This chapter explains how to use many of the features of this versatile editor, from a basic orientation to the use of the META, ALT, and ESCAPE keys; key bindings, buffers, the concept of Point, the cursor, Mark and Region, incremental and complete searching for both character strings and regular expressions; using the online help facilities, cutting and pasting from the keyboard and with a mouse, and using multiple windows and frames; and C mode, which is designed to aid programmers in writing and debugging C code. The chapter concludes with a summary of emacs commands.

Regular Expressions

Many UNIX utilities allow you to use regular expressions to make your job easier. Appendix A explains how to use regular expressions so that you can take advantage of some of the hidden power of your GNU/Linux system.

System Administration

Chapter 17 explains how to set up, control, and keep secure a Red Hat Linux system. The chapter details the responsibilities of the Superuser and explains how to bring up and shut down a Red Hat Linux system, add users to the system, back up files, set up new devices, check the integrity of a filesystem, and more. This chapter goes into detail about the structure of a filesystem and explains what administrative information is kept in various files. In addition, this chapter presents an overview of installing Red Hat Linux, information on rebuilding the GNU/Linux kernel, and managing user accounts, and it provides security boxes throughout:

  • Use the Superuser (root) account
  • Download Red Hat Linux from the Internet and burn a CD-ROM
  • Find/add/remove rpm software packages with rpmfind and rpm
  • Install non-rpm software with the GNU Configure and Build System
  • Understand and manage basic security issues with secure programs including ssh (secure shell) and GnuPG (GNU Privacy Guard)
  • Add and remove users with redhat-config-users and kuser
  • Use RHN (Red Hat Network) to keep your system software up-to-date automatically and to download new packages from Red Hats Internet site.
  • Build a firewall with gnome-lokkit
  • Manage local and remote printers with printconf-gui and KDEPrint
  • Use graphical system administration tools, including GNOME Start Here, GNOME and KDE menu systems, KDE Control Center, and KDE Control Panel
  • Understand system operation, including the boot process, rc scripts, emergency mode, single- and multiuser mode, and what to do when the system crashes
  • Learn about files, directories, and filesystems, including types of files and filesystems, fstab, automatically mounted filesystems, filesystem integrity checks, filesystem utilities, and how to tune filesystems
  • Use backup utilities, including tar, cpio, dump, and restore
  • Use the /proc filesystem
  • Configure network services: proxies, NFS (Network Filesystem), DNS (Domain Name Service), automount filesystems, Samba server, OpenSSH
  • Rebuild the kernel
  • Plan disk layout and partition disks
  • Run system reports
  • Use the Logical Volume Manager (LVM) to grow and migrate partitions without interrupting users
  • Manage printers
  • Connect to the Internet
  • Configure PAM (pluggable authentication modules)
  • Use administration utilities

Programming Environment

Chapter 16 introduces you to GNU/Linuxs exceptional programming environment. This chapter explains how to use some of the most useful software development tools: gcc (the GNU C compiler), the gdb debugger, make, and the CVS and RVS source code management tools. The make utility automates much of the drudgery involved in ensuring that a program you compile contains the latest versions of all program modules. CVS and RVS help you manage source code by tracking multiple versions of files on various types of projects.

  • Manage source code with RCS or CVS
  • Use make to keep a set of programs current
  • Use the GNU C compiler (gcc) and debugger (dbg)
  • Work with shared libraries
  • Understand system calls

POSIX

The IEEE POSIX committees have developed standards for programming and user interfaces, based on historical UNIX practice, and new standards are under development. Appendix D describes these standards and their direction and effect on the UNIX and GNU/Linux industry.

Supplements

The authors home page (www.sobell.com) contains downloadable listings of the longer programs from the book, pointers to many interesting and useful GNU/Linux sites on the World Wide Web, a list of corrections to the book, answers to selected exercises, and a solicitation for corrections, comments, suggestions, and additional programs and exercises.

Thanks

A big Thank You to the folks who read through the drafts of the book and made comments that caused me to refocus parts of the book where things were not clear or were left out altogether. Thanks to Carsten Pfeiffer, Software Engineer and KDE Developer; Dustin Puryear, Puryear Information Technology; Gabor Liptak, Independent Consultant; Bart Schaefer, Chief Technical Officer, iPost; Michael J. Jordan, Web Developer, GNU/Linux Online Inc.; Steven Gibson, owner of SuperAnt.com; John Viega, Founder and Chief Scientist, Secure Software, Inc.; K. Rachael Treu, Internet Security Analyst, Global Crossing; Kara Pritchard, K & S Pritchard Enterprises, Inc; Matthew Miller, Boston University; Glen Wiley, Capitol One Finances; Karel Baloun, Senior Software Engineer, Looksmart, Ltd.; Matthew Whitworth; Dameon D. Welch-Abernathy, Nokia Systems; Josh Simon, Consultant; Stan Isaacs; and Dr. Eric H. Herrin, II, Vice President, Herrin Software Development, Inc.

Thanks to Doug Hughes, who gave me a big hand with the sections on system administration, networks, the Internet, and programming.

Thanks also to the folks at Addison-Wesley who helped bring this book to life: My editor Karen Gettman; Tyrrell Albaugh, production manager, who gave me guidance and much latitude in producing the book; and everyone else who worked behind the scenes to make this book happen.

Thanks to the Texan, JFP (Dr. John Frank Peters), for his many hours on the emacs chapter. His understanding of this editor gives this chapter a depth and breadth that makes you want to dive right in. Fred Zlotnick, author of The POSIX.1 Standard, did a lot of work on Appendix D.

I am also indebted to Denis Howe, who edits The Free On-line Dictionary of Computing. Dennis has graciously permitted me to use entries from his compilation. Be sure to look at the dictionary at foldoc.doc.ic.ac.uk/foldoc .

Thanks to Lorraine Callahan and Steve Wampler, who researched, wrote, analyzed reviews, and coordinated all the efforts that went into the first Linux book. Thanks for help on my first Linux book to Ronald Hiller, Graburn Technology, Inc.; Charles A. Plater, Wayne State University; Bob Palowoda, Tom Bialaski, Sun Microsystems; Roger Hartmuller, TIS Labs at Network Associates; Kaowen Liu, Andy Spitzer, Rik Schneider, Jesse St. Laurent, Steve Bellenot, Ray W. Hiltbrand, Jennifer Witham, Gert-Jan Hagenaars, and Casper Dik.

A Practical Guide to Red Hat Linux 8 is based in part on two of my previous UNIX books: UNIX System V: A Practical Guide and A Practical Guide to Linux. Many people helped me with those books, and thanks here go to Pat Parseghian, Dr. Kathleen Hemenway, and Brian LaRose; Byron A. Jeff, Clark Atlanta University; Charles Stross; Jeff Gitlin, Lucent Technologies; Kurt Hockenbury; Maury Bach, Intel Israel Ltd.; Peter H. Salus; Rahul Dave, University of Pennsylvania; Sean Walton, Intelligent Algorithmic Solutions; Tim Segall, Computer Sciences Corporation; Behrouz Forouzan, DeAnza College; Mike Keenan, Virginia Polytechnic Institute and State University; Mike Johnson, Oregon State University; Jandelyn Plane, University of Maryland; Arnold Robbins and Sathis Menon, Georgia Institute of Technology; Cliff Shaffer, Virginia Polytechnic Institute and State University; and Steven Stepanek, California State University, Northridge, for reviewing the book.

I also continue to be grateful to the many people who helped with the early editions of my UNIX books. Special thanks to Roger Sippl, Laura King, and Roy Harrington for introducing me to the UNIX system. My mother, Dr. Helen Sobell, provided invaluable comments on the original manuscript at several junctures. Also thanks to Isaac Rabinovitch, Professor Raphael Finkel, Professor Randolph Bentson, Bob Greenberg, Professor Udo Pooch, Judy Ross, Dr. Robert Veroff, Dr. Mike Denny, Joe DiMartino, Dr. John Mashey, Diane Schulz, Robert Jung, Charles Whitaker, Don Cragun, Brian Dougherty, Dr. Robert Fish, Guy Harris, Ping Liao, Gary Lindgren, Dr. Jarrett Rosenberg, Dr. Peter Smith, Bill Weber, Mike Bianchi, Scooter Morris, Clarke Echols, Oliver Grillmeyer, Dr. David Korn, Dr. Scott Weikart, and Dr. Richard Curtis.

Dr. Brian Kernighan and Rob Pike graciously allowed me to reprint the bundle script from their book The UNIX Programming Environment.

Finally, thanks to the brothers at JumpStart for providing nourishment through the final push. As Peter said, You wouldnt have finished that book until 2010 if it werent for us!

I take responsibility for errors and omissions. If you find one or just have a comment, let me know (mark@sobell.com), and Ill fix it in the next printing. My home page (www.sobell.com) will contain a list of errors and those who found them, as well as copies of the longer scripts from the book and pointers to many interesting GNU/Linux pages.

Mark G. Sobell

San Francisco, California