LPI LINUX CERTIFICATION IN A NUTSHELL A Desktop Quick Reference ,TITLE.19374 Page 1 Tuesday, October 9, 2001 2:31 PM ,TITLE.19374 Page 2 Tuesday, October 9, 2001 2:31 PM LPI LINUX CERTIFICATION IN A NUTSHELL A Desktop Quick Reference Jeffrey Dean Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo ,TITLE.19374 Page 3 Tuesday, October 9, 2001 2:31 PM LPI Linux Certification in a Nutshell by Jeffrey Dean Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472. Editor: Chuck Toporek Production Editor: Mary Brady Cover Designer: Ellie Volckhausen Printing History: June 2001: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly & Associates, Inc. The association between the image of a Texas longhorn cow and LPI Linux certification is a trademark of O’Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. Linux is a registered trademark of Linus Torvalds. Red Hat and RPM are registered trademarks of Red Hat, Inc. Windows is a registered trademark of Microsoft Corporation. PostScript and Portable Document Format (PDF) are registered trademarks of Adobe Systems, Inc. Jaz and Zip are registered trademarks of Iomega Corporation. The Glossary is copyrighted by the Linux Professional Institute (LPI) and is used with permission. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 1-56592-748-6 [M] [8/01] ,Copyright.19230 Page 1 Tuesday, October 9, 2001 2:31 PM About the Author Jeffrey Dean is a freelance author, editor, and consultant in Philadelphia, Pennsyl- vania. Jeffrey has professional experience in IT management, training delivery, and system administration of Linux, Solaris, VMS, AS/400, and Windows NT/2000. Jeffrey holds an undergraduate degree in electrical engineering from the Univer- sity of Pittsburgh and a master’s degree in engineering with emphasis in computer design from Penn State. He holds the Linux Professional Institute Level 1 (LPIC-1) and Red Hat Certified Engineer (RHCE) certifications. Colophon Our look is the result of reader comments, our own experimentation, and feed- back from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of LPI Linux Certification in a Nutshell is a Texas long- horn cow. Christopher Columbus originally brought cattle to the New World from Spain. Descendants of these animals mated with English cows, and the offspring gradually evolved into the breed we know today. Unfortunately, this animal was once on the verge of extinction. In the 180’s and the early 1900s, tallow was a valued resource, as it is a key ingredient in candles and soaps. Animal fat is a major component of tallow, and the naturally lean long horn didn’t have enough of it to be considered useful in making a fat-based concoction. As a result, the longhorn was cross-bred with cattle who had more fat, so cattle ranchers would be assured of a larger financial profit in the tallow industry. Purebred Texas longhorns were being phased out. However, in 1927, the U.S. Congress decided to step in, and formed a government herd of this breed, to save them from disappearing altogether. Very few purebred Texas longhorns were found, but Congress did manage to round up 27 animals, which were placed in a reserve area in Oklahoma. Today, the Texas longhorn is enjoying a rebirth of sorts, with numbers in the U.S. of up to 100,000. Mary Brady was the production editor and proofreader, and Norma Emory was the copyeditor for LPI Linux Certification in a Nutshell. Nicole Arigo and Claire Cloutier provided quality control. Edith Shapiro and Sada Preisch provided production assistance. John Bickelhaupt wrote the index. ,COLOPHON.19095 Page 1 Tuesday, October 9, 2001 2:31 PM Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The cover image is an original illustration created by Lorrie LeJeune. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe’s ITC Garamond font. David Futato designed the interior layout based on a series design by Nancy Priest. Anne-Marie Vaduva converted the files from Microsoft Word to FrameMaker 5.5.6 using tools created by Mike Sierra. The text and heading fonts are ITC Garamond Light and Garamond Book; the code font is Constant Willison. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. This colophon was written by Mary Brady. Whenever possible, our books use a durable and flexible lay-flat binding. If the page count exceeds this binding’s limit, perfect binding is used. ,COLOPHON.19095 Page 2 Tuesday, October 9, 2001 2:31 PM v Computer Crime: A Crimefighter’s Handbok, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Table of Contents Preface xi Part 1: General Linux Exam 101 Exam 101 Overview 3 Exam 101 Study Guide 6 Exam Preparation 6 GNU and Unix Commands (Topic 1.3) 9 Work Effectively on the Unix Command Line 10 Process Text Streams Using Text-Processing Filters 19 Perform Basic File Management 33 Use Unix Streams, Pipes, and Redirects 41 Create, Monitor, and Kill Processes 45 Modify Process Execution Priorities 56 Making Use of Regular Expressions 59 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4) 70 Create Partitions and Filesystems 71 Maintain the Integrity of Filesystems 82 Control Filesystem Mounting and Unmounting 89 Set and View Disk Quotas 95 ,linux_certTOC.fm.16591 Page v Tuesday, October 9, 2001 2:16 PM vi Table of Contents Computer Crime: A Crimefighter’s Handbok, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Use File Permissions to Control Access to Files 104 Manage File Ownership 114 Create and Change Hard and Symbolic Links 116 Find System Files and Place Files in the Correct Location 122 Boot, Initialization, Shutdown, and Runlevels (Topic 2.6) 134 Boot the System 135 Change Runlevels and Shutdown or Reboot the System 137 Documentation (Topic 1.8) 146 Use and Manage Local System Documentation 147 Find Linux Documentation on the Internet 155 Write System Documentation 160 Provide User Support 163 Administrative Tasks (Topic 2.11) 164 Manage Users and Group Accounts 165 Tune the User Environment 174 Configure and Use System Log Files 176 Automate System Administration Tasks 180 Maintain an Effective Data Backup Strategy 184 Exam 101 Review Questions and Exercises 198 GNU and Unix Commands (Topic 1.3) 198 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4) 202 Boot, Initialization, Shutdown, and Runlevels (Topic 2.6) 205 Documentation (Topic 1.8) 206 Administrative Tasks (Topic 2.11) 210 Exam 101 Practice Test 212 Exam 101 Highlighter’s Index 227 GNU and Unix Commands (Topic 1.3) 227 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4) 234 Boot, Initialization, Shutdown, and Runlevels (Topic 2.6) 240 Documentation (Topic 1.8) 242 Administrative Tasks (Topic 2.11) 245 ,linux_certTOC.fm.16591 Page vi Tuesday, October 9, 2001 2:16 PM Table of Contents vii Computer Crime: A Crimefighter’s Handbok, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Part 2: General Linux Exam 102 Exam 102 Overview 251 Exam 102 Study Guide 254 Exam Preparation 254 Hardware and Architecture (Topic 1.1) 258 Configure Fundamental System Hardware 258 Set Up SCSI and NIC Devices 262 Configure Modems and Sound Cards 267 Linux Installation and Package Management (Topic 2.2) 270 Design a Hard Disk Layout 271 Install a Boot Manager 274 Make and Install Programs from Source 277 Manage Shared Libraries 284 Use Debian Package Management 287 Use Red Hat Package Manager (RPM) 293 Kernel (Topic 1.5) 300 Manage Kernel Modules at Runtime 300 Reconfigure, Build, and Install a Custom Kernel and Modules 310 Text-Editing, Processing, and Printing (Topic 1.7) 320 Perform Basic File Editing Operations Using vi 320 Manage Printers and Print Queues 324 Print Files 331 Install and Configure Local and Remote Printers 332 Shells, Scripting, Programming, and Compiling (Topic 1.9) 339 Customize and Use the Shell Environment 340 Customize or Write Simple Scripts 351 ,linux_certTOC.fm.16591 Page vii Tuesday, October 9, 2001 2:16 PM viii Table of Contents Computer Crime: A Crimefighter’s Handbok, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. X (Topic 2.10) 367 An Overview of X 367 Install and Configure XFree86 368 Set Up xdm 380 Identify and Terminate Runaway X Applications 383 Install and Customize a Window Manager Environment 384 Networking Fundamentals (Topic 1.12) 389 Fundamentals of TCP/IP 389 TCP/IP Troubleshooting and Configuration 400 Configure and Use PPP 414 Networking Services (Topic 1.13) 424 Configure and Manage inetd and Related Services 425 Operate and Perform Basic Configuration of sendmail 429 Operate and Perform Basic Configuration of Apache 432 Properly Manage the NFS, SMB, and NMB Daemons 434 Set Up and Configure Basic DNS Services 439 Security (Topic 1.14) 446 Perform Security Administration Tasks 446 Set Up Host Security 458 Set Up User-Level Security 460 Exam 102 Review Questions and Exercises 462 Hardware and Architecture (Topic 1.1) 462 Linux Installation and Package Management (Topic 2.2) 464 Kernel (Topic 1.5) 465 Text Editing, Processing, and Printing (Topic 1.7) 466 Shells, Scripting, Programming, and Compiling (Topic 1.9) 467 X (Topic 2.10) 467 Networking Fundamentals (Topic 1.12) 469 Networking Services (Topic 1.13) 470 Security (Topic 1.14) 471 ,linux_certTOC.fm.16591 Page viii Tuesday, October 9, 2001 2:16 PM [...]... different Linux is both a commodity operating system and is PC-based, and its popularity continues to grow at a rapid pace As Linux deployment increases, so too does the demand for qualified and certified Linux system administrators A number of programs—the Linux Professional Institute, Sair Linux and GNU Certification, the Red Hat Certified Engineer (RHCE) program, and CompTIA’s Linux+ — have formed... C-f C -a C-e Description Previous line (also up arrow) Next line (also down arrow) Back one character (also left arrow) Forward one character (also right arrow) Beginning of line End of line * An editing style similar to the vi editor is also available † In unusual circumstances, such as on a terminal, using the meta key means pressing the Escape (Esc) key, releasing it, and then pressing the defined... general good advice as well as some specific information on PC hardware, my thanks go to Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman, authors of Running Linux, Third Edition Likewise, Linux in a Nutshell, Third Edition, by Ellen Siever, Stephen Spainhour, Jessica P Hekman, and Stephen Figgins, is invaluable for reference information like bash programming details I’m also indebted to the many volunteer... if the PATH is incomplete Entering multiple-line commands interactively In addition to its interactive capabilities, the shell also has a complete programming language of its own Many programming features can be very handy at the interactive command line as well Looping constructs, including for, until, and while are often used this way When you begin a command such as these, which normally spans multiple... skills and methods required for the day-to-day use of Linux If you have a basic working understanding of Linux administration, the material in this book will help you fill in gaps in your knowledge while at the same time preparing you for the LPI exams, should you choose to take them This book should also prove to be a valuable introduction for new Linux users and administrators looking for a broad, detailed... to a single line, the commands can be separated and entered sequentially with the command separator, a semicolon Using this syntax, the following commands: $ ls $ ps are, in essence, identical to and will yield the same result as the following singleline command that employs the command separator: $ ls; ps On the Exam Command syntax and the use of the command line is very important Pay special attention... bash maintains a set of shell variables that contain information important to the execution of bash Most of these variables are set when bash starts, but they can be set manually at any time The first shell variable of interest in this Topic is called PS1 (which simply stands for Prompt String 1) This special variable holds the contents of the command prompt that are displayed when bash is ready to accept... You may establish an online account with VUE and resister for the exams using the company’s web site VUE has more than two thousand testing centers worldwide, making the exams accessible in most areas The exams are presented in English using a PC-based automated examination program Exam questions are presented in multiple-choice single-answer, multiple-choice multipleanswer, and fill -in- the-blank styles... to manage just about everything on a Linux system, a firm understanding of basic use of command-line utilities is essential The family of commands that are part of Linux and Unix systems has a long history Individuals or groups that needed specific tools contributed many of the commands in the early days of Unix development Those that were popular became part of the system and were accepted as default... signify a tip, suggestion, or general note WARNING These indicate a warning or caution A final word about syntax: in many cases, the space between an option and its argument can be omitted In other cases, the spacing (or lack of spacing) must be followed strictly For example, -wn (no intervening space) might be interpreted differently from -w n It’s important to notice the spacing used in option syntax . appear in this book, and O’Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. Linux is a registered trademark of Linus Torvalds Modems and Sound Cards 267 Linux Installation and Package Management (Topic 2.2) 270 Design a Hard Disk Layout 271 Install a Boot Manager 274 Make and Install Programs from Source 277 Manage Shared. prove to be a valuable introduction for new Linux users and administrators looking for a broad, detailed introduction to Linux. Part of the LPI exam–creation process includes a survey of Linux professionals