Table Of ContentLPI LINUX
CERTIFICATION
IN A NUTSHELL
LPI LINUX
CERTIFICATION
IN A NUTSHELL
Third Edition
Adam Haeder, Stephen Addison Schneiter,
Bruno Gomes Pessanha, and James Stanger
Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo
LPI Linux Certification in a Nutshell, Third Edition
by Adam Haeder, Stephen Addison Schneiter, Bruno Gomes Pessanha, and James
Stanger
Copyright © 2010 Adam Haeder, Stephen Addison Schneiter, Bruno Gomes Pessanha, and
James Stanger. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online
editions are also available for most titles (http://my.safaribooksonline.com). For more infor-
mation, contact our corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor: Andy Oram Indexer: Jay Marchand
Production Editor: Adam Zaremba Cover Designer: Karen Montgomery
Copyeditor: Genevieve d’Entremont Interior Designer: David Futato
Proofreader: Jennifer Knight Illustrator: Robert Romano
Printing History:
May 2001: First Edition.
July 2006: Second Edition.
June 2010: Third Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trade-
marks of O’Reilly Media, Inc. LPI Linux Certification in a Nutshell, the image of a bull, and
related trade dress are trademarks of O’Reilly Media, 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 Media,
Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and
authors assume no responsibility for errors or omissions, or for damages resulting from the
use of the information contained herein.
TM
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN: 978-0-596-80487-9
[M]
1276182761
Table of Contents
Preface ............................................................ xiii
1. LPI Exams ...................................................... 1
2. Exam 101 Study Guide ........................................... 5
Exam Preparation 5
3. System Architecture (Topic 101.1) .................................. 7
Objective 1: Determine and Configure Hardware Settings 7
BIOS 7
USB Topology 10
USB Controllers 10
USB Devices 11
USB Drivers 11
USB Hotplug 12
Reporting Your Hardware 12
Manipulating Modules 14
Device Management Definitions 20
4. Change Runlevels and Shut Down or Reboot System (Topics 101.2 and
101.3) ........................................................ 21
Objective 2: Boot the System 21
Boot-time Kernel Parameters 21
Introduction to Kernel Module Configuration 22
Objective 3: Change Runlevels and Shut Down or Reboot System 24
Single-User Mode 25
Overview of the /etc Directory Tree and the init Process 26
v
Setting the Default Runlevel 28
Determining Your System’s Runlevel 28
5. Linux Installation and Package Management (Topic 102) ............. 33
Objective 1: Design a Hard Disk Layout 34
System Considerations 34
Swap Space 37
General Guidelines 38
Objective 2: Install a Boot Manager 38
LILO 39
GRUB 41
Objective 3: Manage Shared Libraries 44
Shared Library Dependencies 44
Linking Shared Libraries 45
Objective 4: Use Debian Package Management 46
Debian Package Management Overview 46
Managing Debian Packages 47
Objective 5: Use Red Hat Package Manager (RPM) 52
RPM Overview 52
Running rpm 53
YUM Overview 58
6. GNU and Unix Commands (Topic 103) .............................. 63
Objective 1: Work on the Command Line 64
The Interactive Shell 65
Command History and Editing 71
Manpages 75
Objective 2: Process Text Streams Using Filters 77
Objective 3: Perform Basic File Management 91
Filesystem Objects 91
File-Naming Wildcards (File Globbing) 100
Objective 4: Use Streams, Pipes, and Redirects 102
Standard I/O and Default File Descriptors 102
Pipes 103
Redirection 104
Using the tee Command 106
The xargs Command 106
Objective 5: Create, Monitor, and Kill Processes 107
Processes 107
Process Monitoring 108
Signaling Active Processes 115
Terminating Processes 117
Shell Job Control 118
Objective 6: Modify Process Execution Priorities 120
nice 120
Objective 7: Search Text Files Using Regular Expressions 123
vi | Table of Contents
Regular Expression Syntax 123
Using grep 125
Using sed 127
Examples 130
Objective 8: Perform Basic File Editing Operations Using vi 135
Invoking vi 135
vi Basics 135
7. Devices, Linux Filesystems, and the Filesystem Hierarchy
Standard (Topic 104) .......................................... 139
Objective 1: Create Partitions and Filesystems 140
Disk Drives Under Linux 140
Objective 2: Maintain the Integrity of Filesystems 151
Monitoring Free Disk Space and Inodes 151
Monitoring Disk Usage 153
Modifying a Filesystem 154
Checking and Repairing Filesystems 157
Objective 3: Control Filesystem Mounting and Unmounting 161
Managing the Filesystem Table 161
Mounting Filesystems 163
Unmounting Filesystems 166
Objective 4: Set and View Disk Quotas 167
Quota Limits 168
Quota Commands 169
Enabling Quotas 175
Objective 5: Manage File Permissions and Ownership 176
Linux Access Control 176
Setting Access Modes 181
Setting Up a Workgroup Directory 186
Objective 6: Create and Change Hard and Symbolic Links 187
Why Links? 188
Objective 7: Find System Files and Place Files in the Correct Location 192
Datatypes 193
The root Filesystem 194
Locating Files 200
8. Exam 101 Review Questions and Exercises ........................ 205
System Architecture (Topic 101) 205
Review Questions 205
Exercises 206
Linux Installation and Package Management (Topic 102) 206
Review Questions 206
Exercises 207
GNU and Unix Commands (Topic 103) 208
Review Questions 208
Exercises 208
Table of Contents | vii
Devices, Linux Filesystems, and the Filesystem Hierarchy Standard
(Topic 104) 211
Review Questions 211
Exercises 212
9. Exam 101 Practice Test ......................................... 215
Questions 215
Answers 226
10. Exam 101 Highlighter’s Index ................................... 229
System Architecture 229
Objective 101.1: Determine and Configure Hardware Settings 229
Objective 101.2: Boot the System 230
Objective 101.3: Change Runlevels and Shut Down or
Reboot System 230
Linux Installation and Package Management 230
Objective 102.1: Design Hard Disk Layout 230
Objective 102.2: Install a Boot Manager 231
Objective 102.3: Manage Shared Libraries 231
Objective 102.4: Use Debian Package Management 232
Objective 102.5: Use Red Hat Package Manager (RPM) 232
GNU and Unix Commands 232
Objective 103.1: Work on the Command Line 232
Objective 103.2: Process Text Streams Using Filters 233
Objective 103.3: Perform Basic File Management 235
Objective 103.4: Use Streams, Pipes, and Redirects 237
Objective 103.5: Create, Monitor, and Kill Processes 238
Objective 103.6: Modify Process Execution Priorities 239
Objective 103.7: Search Text Files Using Regular Expressions 239
Objective 103.8: Perform Basic File Editing Operations Using vi 241
Devices, Linux Filesystems, and the Filesystem Hierarchy Standard 243
Objective 104.1: Create Partitions and Filesystems 243
Objective 104.2: Maintain the Integrity of Filesystems 244
Objective 104.3: Control Filesystem Mounting and Unmounting 244
Objective 104.4: Set and View Disk Quotas 246
Objective 104.5: Manage File Permissions and Ownership 246
Objective 104.6: Create and Change Hard and Symbolic Links 248
Objective 104.7: Find System Files and Place Files in the Correct
Location 248
11. Exam 102 Overview ........................................... 251
12. Exam 102 Study Guide ......................................... 253
Exam Preparation 253
viii | Table of Contents
Description:Linux deployment continues to increase, and so does the demand for qualified and certified Linux system administrators. If you're seeking a job-based certification from the Linux Professional Institute (LPI), this updated guide will help you prepare for the technically challenging LPIC Level 1 Exams