34
ALL IN ONE LPIC-1/CompTIA Linux+ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto McGraw-Hill is an independent entity from CompTIA® and the Linux Professional Institute (LPI®). This publication and CD may be used in assisting students to prepare for the CompTIA Linux+ exams or the LPIC-1 exam from LPI. Neither CompTIA, nor LPI, nor McGraw-Hill warrant that use of this publication and CD will ensure passing any exam. CompTIA and CompTIA Linux+ are trademarks or registered trademarks of CompTIA in the United States and/or other countries. LPI is a trademark or registered trademark of the Linux Professional Institute. All other trade- marks are trademarks of their respective owners.

ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

Embed Size (px)

Citation preview

Page 1: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

ALL IN ONE

LPIC-1/CompTIA Linux+™

CertificationE X A M G U I D E

( E x a m s L P I C - 1 / L X 0 - 1 0 1 & L X 0 - 1 0 2 )

Robb H. Tracy

New York • Chicago • San Francisco • Lisbon London • Madrid • Mexico City • Milan • New Delhi

San Juan • Seoul • Singapore • Sydney • Toronto

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 blind folio: iii

McGraw-Hill is an independent entity from CompTIA® and the Linux Professional Institute (LPI®). This publication and CD may be used in assisting students to prepare for the CompTIA Linux+ exams or the LPIC-1 exam from LPI. Neither CompTIA, nor LPI, nor McGraw-Hill warrant that use of this publication and CD will ensure passing any exam. CompTIA and CompTIA Linux+ are trademarks or registered trademarks of CompTIA in the United States and/or other countries. LPI is a trademark or registered trademark of the Linux Professional Institute. All other trade-marks are trademarks of their respective owners.

FM.indd 3 7/29/11 1:32 PM

Page 2: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

Cataloging-in-Publication Data is on file with the Library of Congress

McGraw-Hill books are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative, please e-mail us at [email protected].

LPIC-1/CompTIA Linux+™ Certification All-in-One Exam Guide (Exams LPIC-1/LX0-101 & LX0-102)

Copyright © 2012 by The McGraw-Hill Companies. All rights reserved. Printed in the United States of America. Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be re-produced for publication.

All trademarks or copyrights mentioned herein are the possession of their respective owners and McGraw-Hill makes no claim of ownership by the mention of products that contain these marks.

1234567890 DOC DOC 10987654321

ISBN: Book p/n 978-0-07-177158-0 and CD p/n 978-0-07-177159-7 of set 978-0-07-177157-3

MHID: Book p/n 0-07-177158-1 and CD p/n 0-07-177159-X of set 0-07-177157-3

Sponsoring EditorTimothy Green

Editorial SupervisorPatty Mon

Project EditorEmilia Thiuri, Fortuitous Publishing Services

Acquisitions CoordinatorStephanie Evans

Technical EditorBrian Barber

Copy EditorBob Campbell

ProofreadersJeff Holt, Scott Klemp

IndexerJack Lewis

Production SupervisorJames Kussow

CompositionApollo Publishing Services

IllustrationLyssa Wald

Art Director, CoverJeff Weeks

Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 blind folio iv

FM.indd 4 7/29/11 1:32 PM

Page 3: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

This book is dedicated to all the individuals who have made a difference in my life. To my Dad, for instilling in me a love of teaching and of all things mechanical.

To my Mom, for teaching me the value of hard work and devotion. To my mentor, Dennis Simmons, for

teaching me to strive for excellence in all I do. To my wife and best friend, for supporting and loving me

through the process of writing this book.

—Robb H. Tracy

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 blind folio: v

FM.indd 5 7/29/11 1:32 PM

Page 4: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

ABOUT THE AUTHOR

Robb H. Tracy (CNA, CNE, CNI, A+, Network+, Linux+) has been a professional technol-ogy instructor and courseware developer since 1996. He has designed and implemented technical training products and curricula for major hardware and software vendors including Novell, Micron Technology, TestOut, Messaging Architects, Caselle, Mov-eNetworks, Makau, Cymphonix, and NextPage. Robb previously served on CompTIA’s Network+ Advisory Committee, where he helped define the objectives that make up the CompTIA Network+ certification. He is a cofounder of Nebo Technical Institute, Inc., a leading provider of information technology training and consulting. Robb is the author of Novell Certified Linux Engineer (Novell CLE) Study Guide (Novell Press, 2005), Novell Certified Linux Engineer 9 (CLE 9) Study Guide (Novell Press, 2006), and Linux+ Certification Study Guide (Certification Press, 2008). Robb was also a contributing au-thor to SUSE Linux 10 Unleashed (Sams Publishing, 2006).

About the Technical EditorBrian Barber (Linux+, MCSE, MCSA, MCP+I, MCNE, CNE, CNA-GW) is the Manager of Monitoring and Reporting Systems with the Canada Deposit Insurance Corporation (CDIC). He first started using Linux at home with Red Hat 5.1, and since then he has been a staunch advocate of open source software in both commercial and residential settings; he has belonged to the Ottawa Canada Linux User Group (OCLUG) since 2001. His primary areas of interest are operating systems, multiplatform integration, directory services, and enterprise messaging. In the past he has held the positions of Principal Consultant with Sierra Systems Group, Senior Technical Coordinator with LGS Group (now a part of IBM Global Services), and Senior Technical Analyst with MetLife Canada. Brian has been a lead author or a contributing and technical edi-tor to over 15 technology books.

About LearnKeyLearnKey provides self-paced learning content and multimedia delivery solutions to enhance personal skills and business productivity. LearnKey claims the largest library of rich streaming-media training content that engages learners in dynamic media-rich instruction complete with video clips, audio, full motion graphics, and animated illustrations. LearnKey can be found on the web at www.LearnKey.com.

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: vi

FM.indd 6 7/29/11 1:32 PM

Page 5: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

CompTIA Linux+ Powered by LPICompTIA Linux+ Powered by LPI+ certification held by many IT Staff in organiza-tions: 25% of IT staff within a random sampling of U.S. organizations within a cross section of industry verticals hold CompTIA Linux+ certification.

• CompTIA Linux+ Powered by LPI validates the fundamental knowledge and skills required of junior Linux administrators. The exams cover system architecture, GNU and UNIX commands, user interfaces and desktops, and Linux installation and package management.

• Candidate Job Roles include junior Linux administrator, junior network administrator, systems administrator, Linux database administrator and web administrator.

• Dual Certification if you choose, Certification in CompTIA Linux+ Powered by LPI, attained by passing CompTIA exams LX0-101 and LX0-102, enables you to become certified in LPIC-1 as well.

• Starting Salary The average salary for CompTIA Linux+ Powered by LPI+ certification holders is $76,000 (USA).

• Mandated/RecommendedbyorganizationsworldwideCompaniessuchasDell, HP, IBM, Lenovo, and Xerox recommend or require CompTIA Linux+.

It Pays to Get CertifiedIn a digital world, digital literacy is an essential survival skill. Certification proves you have the knowledge and skills to solve business problems in virtually any business en-vironment. Certifications are highly valued credentials that qualify you for jobs, in-creased compensation, and promotion.

How Certification Helps Your Career

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: vii

FM.indd 7 7/29/11 1:32 PM

Page 6: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: viii

CompTIA Career PathwayCompTIA offers a number of credentials that form a foundation for your career in tech-nology and allow you to pursue specific areas of concentration. Depending on the path you choose to take, CompTIA certifications help you build upon your skills and knowl-edge, supporting learning throughout your entire career.

FM.indd 8 7/29/11 1:32 PM

Page 7: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: ix

Four Steps to Getting Certified 1. Review Exam Objectives. Review the Certification objectives to make sure you

know what is covered in the exam. http://www.comptia.org/certifications/testprep/examobjectives.aspx

2. Practice for the Exam. After you have studied for the certification, take a free assessment and sample test to get an idea what type of questions might be on the exam. http://www.comptia.org/certifications/testprep/practicetests.aspx

3. Purchase an Exam Voucher. Purchase exam vouchers on the CompTIA Marketplace, which is located at: www.comptiastore.com

4. Take the Test! Select a certification exam provider and schedule a time to take your exam. You can find exam providers at the following link: http://www.comptia.org/certifications/testprep/testingcenters.aspx

Join the Professional CommunityThe free IT Pro online community provides valuable content to students and profes-sionals.

Career IT job resources include

• WheretostartinIT

• CareerAssessments

• SalaryTrends

• U.S.JobBoard

Join the IT Pro Community and get access to

• ForumsonNetworking,Security,Computing,andCuttingEdgeTechnologies

• AccesstoblogswrittenbyIndustryExperts

• CurrentinformationonCuttingEdgeTechnologies

• AccesstovariousindustryresourcelinksandarticlesrelatedtoITandITcareers

FM.indd 9 7/29/11 1:32 PM

Page 8: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

Content Seal of QualityThis courseware bears the seal of CompTIA Approved Quality Content. This seal signi-fies this content covers 100% of the exam objectives and implements important instruc-tional design principles. CompTIA recommends multiple learning tools to help in-crease coverage of the learning objectives.

Why CompTIA?• Global recognition CompTIA is recognized globally as the leading IT

non-profit trade association and has enormous credibility. Plus, CompTIA’s certifications are vendor-neutral and offer proof of foundational knowledge that translates across technologies.

• Valued by hiring managers Hiring managers value CompTIA certification because it is vendor and technology independent validation of your technical skills.

• Recommended or required by government and businesses Many government organizations and corporations either recommend or require technical staff to be CompTIA certified. (e.g., Dell, Sharp, Ricoh, the U.S. Department of Defense, and many more)

• Three CompTIA certifications ranked in the top 10 In a study by DICE of 17,000 technology professionals, certifications helped command higher salaries at all experience levels.

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: x

FM.indd 10 7/29/11 1:32 PM

Page 9: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

How to Obtain More Information

Visit CompTIA Onlinewww.comptia.org to learn more about getting CompTIA certified.

Contact CompTIAPlease call 866-835-8020, ext. 5 or e-mail [email protected].

Social MediaFind us on Facebook, LinkedIn, Twitter, and YouTube.

Join the IT Pro Communityhttp://itpro.comptia.org to join the IT community to get relevant career information.

(2)CAQC DisclaimerThe logo of the CompTIA Approved Quality Curriculum Program and the status of this or other training material as “Approved” under the CompTIA Approved Curriculum Program signifies that, in CompTIA’s opinion, such training material covers the content of the CompTIA’s related certification exam. CompTIA has not reviewed or approved the accuracy of the contents of this training material and specifically disclaims any war-ranties of merchantability or fitness for a particular purpose. CompTIA makes no guar-antee concerning the success of persons using any such “Approved” or other training material in order to prepare for any CompTIA certification exam.

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3/ blind folio: xi

FM.indd 11 7/29/11 1:32 PM

Page 10: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

CONTENTS AT A GLANCE

Chapter 1 Introduction to Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 2 Working with the Linux Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Chapter 3 Using the vi Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Chapter 4 Managing Linux Files and Directories . . . . . . . . . . . . . . . . . . . . . . . 91

Chapter 5 Installing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Chapter 6 Managing the Linux Boot Process . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Chapter 7 Managing the Graphical Environment . . . . . . . . . . . . . . . . . . . . . . . 229

Chapter 8 Managing Linux Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

Chapter 9 Managing Linux Users and Groups . . . . . . . . . . . . . . . . . . . . . . . . . 329

Chapter 10 Managing Linux File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

Chapter 11 Managing Ownership, Permissions, and Quotas . . . . . . . . . . . . . . . 403

Chapter 12 Managing Hardware Under Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 429

Chapter 13 Managing Linux Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

Chapter 14 Writing Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

Chapter 15 Managing Linux Network Settings . . . . . . . . . . . . . . . . . . . . . . . . . . 555

Chapter 16 Managing Network Services on Linux . . . . . . . . . . . . . . . . . . . . . . . 601

Chapter 17 Securing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651

Chapter 18 Using Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709

Appendix A Exam Objective Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751

Appendix B About the CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773

xiii

FM.indd 13 7/29/11 1:32 PM

Page 11: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

CONTENTS

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviiIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix

Chapter 1 Introduction to Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1The Role and Function of Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2The Historical Development of Linux . . . . . . . . . . . . . . . . . . . . . . . 4Linux Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Common Linux Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Linux as a Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Linux as a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Linux as a Firewall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Chapter 2 Working with the Linux Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17How the Linux Shell Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Linux Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Managing Shell Configuration Files . . . . . . . . . . . . . . . . . . . . 21

Using the Shell Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Entering Commands at the Shell Prompt . . . . . . . . . . . . . . . . 24Using Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Using Command Completion . . . . . . . . . . . . . . . . . . . . . . . . . 30

Getting Help for Linux Commands . . . . . . . . . . . . . . . . . . . . . . . . . 31Using man Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Using info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Working with Environment Variables . . . . . . . . . . . . . . . . . . . . . . . 42What Are Environment Variables? . . . . . . . . . . . . . . . . . . . . . 42Managing Environment Variables . . . . . . . . . . . . . . . . . . . . . . 43Creating a User-Defined Variable . . . . . . . . . . . . . . . . . . . . . . 49

Working with Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Using Redirection and Piping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Standard bash File Descriptors . . . . . . . . . . . . . . . . . . . . . . . . 52Redirecting Output and Input for Shell Commands . . . . . . . 53Piping Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

xv

FM.indd 15 7/29/11 1:32 PM

Page 12: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xviContents

xvii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Chapter 3 Using the vi Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71The Role and Function of the vi Text Editor . . . . . . . . . . . . . . . . . . . 72Editing Text Files in vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Opening Files in vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76vi Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Working in Insert Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Working in Command-Line Mode . . . . . . . . . . . . . . . . . . . . . 79Working in Command Mode . . . . . . . . . . . . . . . . . . . . . . . . . 80

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Chapter 4 Managing Linux Files and Directories . . . . . . . . . . . . . . . . . . . . . . . 91Linux File Systems and the Filesystem Hierarchy Standard (FHS) . 92

The Role of the Linux File System . . . . . . . . . . . . . . . . . . . . . . 92The Hierarchical Structure of the Linux File System . . . . . . . . 92Types of Files Used by Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Finding Files in the Linux File System . . . . . . . . . . . . . . . . . . . . . . . 101Using find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101Using locate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102Using which . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Using whereis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Using type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

Managing Directories from the Command Line . . . . . . . . . . . . . . . 106Navigating the File System . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Viewing Directory Contents . . . . . . . . . . . . . . . . . . . . . . . . . . 108Creating New Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Copying, Moving, and Deleting Directories . . . . . . . . . . . . . . 111

Managing Files from the Command Line . . . . . . . . . . . . . . . . . . . . . 112Creating New Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112Viewing File Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Deleting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114Copying and Moving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Determining the File Type . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Working with Link Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116Finding Content Within Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Chapter 5 Installing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Designing a Linux Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

Conducting a Needs Assessment . . . . . . . . . . . . . . . . . . . . . . 130Selecting a Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

FM.indd 16 7/29/11 1:32 PM

Page 13: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xviContents

xvii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Verifying System Requirements and Hardware Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Planning the File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Selecting Software Packages . . . . . . . . . . . . . . . . . . . . . . . . . . 146Specify User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147Gathering Network Information . . . . . . . . . . . . . . . . . . . . . . . 148Selecting an Installation Source . . . . . . . . . . . . . . . . . . . . . . . 149

Installing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156Configuring Locale Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Configuring Time Zone Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

How Time Works on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Configuring the Time Zone . . . . . . . . . . . . . . . . . . . . . . . . . . 168

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Chapter 6 Managing the Linux Boot Process . . . . . . . . . . . . . . . . . . . . . . . . . . 181The Linux Boot Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

The BIOS Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183The Bootloader Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184The Kernel Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

Configuring the Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187Configuring LILO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188Configuring GRUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

Managing Linux Runlevels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203How Runlevels Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203Managing Runlevels and init Scripts . . . . . . . . . . . . . . . . . . . 206

Shutting Down the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

Chapter 7 Managing the Graphical Environment . . . . . . . . . . . . . . . . . . . . . . . 229How the X Environment Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230Configuring the X Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

Configuring the X Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235Configuring an X Font Server . . . . . . . . . . . . . . . . . . . . . . . . . 245

Configuring a Display Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248Trying Out Desktop Environments . . . . . . . . . . . . . . . . . . . . . 248Configuring a Display Manager . . . . . . . . . . . . . . . . . . . . . . . 249

Configuring Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253Keyboard Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254Mouse Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Screen Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

FM.indd 17 7/29/11 1:32 PM

Page 14: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xviiiContents

xix

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Screen Magnifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257Braille Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260High-Contrast, Large-Text Themes . . . . . . . . . . . . . . . . . . . . . 261

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

Chapter 8 Managing Linux Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Managing Software with RPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

Installing Software with RPM . . . . . . . . . . . . . . . . . . . . . . . . . 276Managing Installed Software with RPM . . . . . . . . . . . . . . . . . 288Using yum to Install RPM Packages . . . . . . . . . . . . . . . . . . . . 295

Installing Software from Source Code . . . . . . . . . . . . . . . . . . . . . . . 298Preparing the Installation Files . . . . . . . . . . . . . . . . . . . . . . . . 299Compiling the Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Installing the Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302Uninstalling Software Compiled from Source Code . . . . . . . 303

Managing Debian Software Packages . . . . . . . . . . . . . . . . . . . . . . . . 304Debian Package Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305Installing Packages with dpkg . . . . . . . . . . . . . . . . . . . . . . . . 305Viewing Package Information with apt-cache . . . . . . . . . . . . . 308Installing Packages with apt-get . . . . . . . . . . . . . . . . . . . . . . . 310Using aptitude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

Managing Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313How Shared Libraries Work . . . . . . . . . . . . . . . . . . . . . . . . . . 314Managing Shared Library Dependencies . . . . . . . . . . . . . . . . 315

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

Chapter 9 Managing Linux Users and Groups . . . . . . . . . . . . . . . . . . . . . . . . . 329Understanding Linux Users and Groups . . . . . . . . . . . . . . . . . . . . . 331

Linux User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332Linux Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

Chapter 10 Managing Linux File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357Managing Disk Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

Using fdisk to Manage Disk Partitions . . . . . . . . . . . . . . . . . . 358Building a File System with mkfs . . . . . . . . . . . . . . . . . . . . . . 363Understanding LVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

FM.indd 18 7/29/11 1:32 PM

Page 15: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xviiiContents

xix

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Mounting a Partition with mount . . . . . . . . . . . . . . . . . . . . . 368Maintaining Linux File Systems . . . . . . . . . . . . . . . . . . . . . . . 371

Mounting Removable Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381Working with Floppies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381Working with Optical Devices . . . . . . . . . . . . . . . . . . . . . . . . 382Working with USB and FireWire Devices . . . . . . . . . . . . . . . . 383

Backing Up Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384Selecting a Backup Medium . . . . . . . . . . . . . . . . . . . . . . . . . . 385Selecting a Backup Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . 386Using Linux Backup Utilities . . . . . . . . . . . . . . . . . . . . . . . . . 389

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

Chapter 11 Managing Ownership, Permissions, and Quotas . . . . . . . . . . . . . . . 403Managing Ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

How Ownership Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403Managing Ownership from the Command Line . . . . . . . . . . . 404

Managing File and Directory Permissions . . . . . . . . . . . . . . . . . . . . 407How Permissions Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407Managing Permissions from the

Command Line with chmod . . . . . . . . . . . . . . . . . . . . . . . 409Working with Default Permissions . . . . . . . . . . . . . . . . . . . . . 413Working with Special Permissions . . . . . . . . . . . . . . . . . . . . . 415

Implementing Disk Quotas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422

Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

Chapter 12 Managing Hardware Under Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 429Managing PC Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

Identifying Mass Storage Devices . . . . . . . . . . . . . . . . . . . . . . 430Working with Removable Hardware Interfaces . . . . . . . . . . . 441Managing System Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 444Managing Integrated Devices . . . . . . . . . . . . . . . . . . . . . . . . . 449Managing Systems Without External Peripherals . . . . . . . . . . 451

Working with Linux Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451What Exactly Is a Driver Anyway? . . . . . . . . . . . . . . . . . . . . . . 452How Drivers Are Implemented Under Linux . . . . . . . . . . . . . 454Managing Kernel Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . 455Working with Hotplug and Coldplug Devices . . . . . . . . . . . . 462

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

FM.indd 19 7/29/11 1:32 PM

Page 16: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxContents

xxi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Chapter 13 Managing Linux Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475How Linux Handles Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

What Exactly Is a Process? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476The Heredity of Linux Processes . . . . . . . . . . . . . . . . . . . . . . . 478

Managing Running Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482Starting System Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482Viewing Running Processes . . . . . . . . . . . . . . . . . . . . . . . . . . 484Prioritizing Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489Managing Foreground and Background Processes . . . . . . . . . 491Ending a Running Process . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Keeping a Process Running After Logout . . . . . . . . . . . . . . . . 495

Scheduling Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498Using the at Daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498Using the cron Daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

Chapter 14 Writing Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Working with Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

The Components of a Shell Script . . . . . . . . . . . . . . . . . . . . . 517How Shell Scripts Are Executed . . . . . . . . . . . . . . . . . . . . . . . 518

Creating a Basic Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520Displaying Text on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . 520Adding Commands to a Script . . . . . . . . . . . . . . . . . . . . . . . . 520Reading Input from the User . . . . . . . . . . . . . . . . . . . . . . . . . 521

Using Control Structures in Scripts . . . . . . . . . . . . . . . . . . . . . . . . . 523Using if/then Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523Using case Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525Using Looping Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

Processing Text Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530expand and unexpand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530fmt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531join and paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532nl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533pr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535sed and awk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540uniq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540wc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

FM.indd 20 7/29/11 1:32 PM

Page 17: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxContents

xxi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Using Command Substitution and Shell Functions . . . . . . . . . . . . 542Using Command Substitution . . . . . . . . . . . . . . . . . . . . . . . . 542Using Shell Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

Chapter 15 Managing Linux Network Settings . . . . . . . . . . . . . . . . . . . . . . . . . . 555IP Networking Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556

What Is a Protocol? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557How IP Addresses Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561How the Subnet Mask Works . . . . . . . . . . . . . . . . . . . . . . . . . 564Specifying the DNS Server and

Default Gateway Router Addresses . . . . . . . . . . . . . . . . . . . 566Configuring Network Addressing Parameters . . . . . . . . . . . . . . . . . 568

Installing the Ethernet Board . . . . . . . . . . . . . . . . . . . . . . . . . 569Configuring IP Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 570Configuring Routing Parameters . . . . . . . . . . . . . . . . . . . . . . 576Configuring Name Resolver Settings . . . . . . . . . . . . . . . . . . . 578

Troubleshooting Network Problems . . . . . . . . . . . . . . . . . . . . . . . . 581Using a Standardized Troubleshooting Model . . . . . . . . . . . . 581Using ping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583Using netstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585Using traceroute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585Using Name Resolution Tools . . . . . . . . . . . . . . . . . . . . . . . . 587host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598

Chapter 16 Managing Network Services on Linux . . . . . . . . . . . . . . . . . . . . . . . 601Configuring Printing with CUPS . . . . . . . . . . . . . . . . . . . . . . . . . . . 602

How Linux Printing Works . . . . . . . . . . . . . . . . . . . . . . . . . . . 602Installing CUPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604Configuring CUPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605Using the Line Printer Daemon (lpd) . . . . . . . . . . . . . . . . . . 613Troubleshooting Printing Issues . . . . . . . . . . . . . . . . . . . . . . . 613

Maintaining System Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616Setting the Hardware Clock with hwclock . . . . . . . . . . . . . . . 617Synchronizing Time with netdate . . . . . . . . . . . . . . . . . . . . . . 618Synchronizing Time with NTP . . . . . . . . . . . . . . . . . . . . . . . . 618

Managing an MTA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625How E-Mail Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625Using MTA Management Commands on Linux . . . . . . . . . . . 629

FM.indd 21 7/29/11 1:32 PM

Page 18: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxiiContents

xxiii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Managing SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632How Databases Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632Installing MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633Managing Data in the SQL Server . . . . . . . . . . . . . . . . . . . . . . 635

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649

Chapter 17 Securing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651Secure the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651

Securing the Physical Environment . . . . . . . . . . . . . . . . . . . . 651Securing Access to the Operating System . . . . . . . . . . . . . . . . 653

Control User Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655To root Or Not to root? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655Implementing a Strong Password Policy . . . . . . . . . . . . . . . . 659Configuring User Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661Disabling User Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663Auditing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665

Defending Against Network Attacks . . . . . . . . . . . . . . . . . . . . . . . . . 668Mitigating Network Vulnerabilities . . . . . . . . . . . . . . . . . . . . 668Implementing a Firewall with iptables . . . . . . . . . . . . . . . . . . 672

Managing System Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679Configuring Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679Using Log Files to Troubleshoot Problems . . . . . . . . . . . . . . 684Using Log Files to Detect Intruders . . . . . . . . . . . . . . . . . . . . 686

Configuring xinetd and inetd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688Configuring xinetd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689Configuring inetd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707

Chapter 18 Using Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709How Encryption Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710

Symmetric Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711Asymmetric Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712

Encrypting Remote Access with OpenSSH . . . . . . . . . . . . . . . . . . . . 715How OpenSSH Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715Configuring OpenSSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717Tunneling Traffic Through SSH . . . . . . . . . . . . . . . . . . . . . . . 721Configuring SSH to Use Public Key Authentication . . . . . . . . 726

Encrypting Linux Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730How GPG Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730Using GPG to Encrypt Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 731

FM.indd 22 7/29/11 1:32 PM

Page 19: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxiiContents

xxiii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Chapter Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737Accelerated Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748

Appendix A Exam Objective Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751Exam LX0-101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751Exam LX0-102 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760

Appendix B About the CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769

Accessing the MasterExam Practice Exams in Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769

Installing and Running MasterExam . . . . . . . . . . . . . . . . . . . . . . . . 770MasterExam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770

Video Training Clips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771PDF Copy of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771Removing Installation(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771

LearnKey Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . 771

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773

FM.indd 23 7/29/11 1:32 PM

Page 20: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

PREFACE

Congratulations on your decision to become LPIC-1/CompTIA Linux+ certified! By purchasing this book, you’ve taken the first step toward earning one of the hottest cer-tifications around. Being LPIC-1/CompTIA Linux+ certified provides you with a dis-tinct advantage in today’s IT job market. When you obtain your LPIC-1/CompTIA Linux+ certification, you prove to your employer, your coworkers, and yourself that you truly know your stuff with Linux.

This is a big issue. Over the years, I’ve had the opportunity to interview a number of job applicants for open positions in my organization. I learned early on that you can’t rely on the Skills and Knowledge section of an applicant’s résumé to get an accurate picture of what the applicant can and can’t do. Case in point: Several years ago, my group had a position open that required an exceptionally strong technology back-ground. The job posting listed “extensive background with computer hardware and networking” as one of the requirements for the position.

One of the candidates I interviewed claimed in their résumé to have an extensive background in these areas. In fact, during the interview this person claimed to be an expert in the field. I have to admit, the résumé did look impressive.

However, as the interview progressed I began to have some doubts. This person just didn’t speak or act like a true techie, so I decided to administer a little test during the interview. I asked her to connect a storage device to a workstation. A pretty easy task for an “expert,” right? Well, the applicant couldn’t do it. In fact, she didn’t even know where to begin.

To make a long story short, upper management eventually hired this applicant in spite of my concerns. It wasn’t a good situation. She didn’t have the background re-quired and subsequently performed very poorly on the job and eventually quit after only a year. The key problem in this situation was conflicting definitions of a “computer hardware and networking expert.” My team needed someone who could install expan-sion cards, hard drives, and operating systems as well as set up a computer network.

This applicant, on the other hand, had a very different definition of a “computer hardware and networking expert.” She considered herself to be an expert because she knew how to use Microsoft Word, Excel, and PowerPoint. She also knew how to log in to a network using a username and password. In essence, she was an expert end user, but she was not an expert system administrator, which was what we were looking for.

This situation could have been avoided if my company had listed specific certifica-tions in the job requirements instead of just asking for an “extensive background with computer hardware and networking.” Certifications help everyone involved in the hir-ing process. By requiring applicants to have their LPIC-1/CompTIA Linux+ certifica-tion, prospective employers can weed out applicants who really don’t have the skills and knowledge required for a particular position. Having your LPIC-1/CompTIA Linux+ certification also helps you demonstrate to potential employers that you truly have the Linux background you claim on your résumé, giving you an advantage over other job applicants who aren’t certified.

xxv

FM.indd 25 7/29/11 1:32 PM

Page 21: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxvi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

The goal of this book is to help you reach this state of certification nirvana. The LPIC-1/CompTIA Linux+ certification is the perfect place to start. By merging two pop-ular, widely respected industry certifications together (LPIC-1 and Linux+), CompTIA has created the ideal entry-level Linux certification. LPIC-1/CompTIA Linux+ is the first stepping stone on the path to total Linux mastery. After gaining some real-life experi-ence on the job with your LPIC-1/CompTIA Linux+ certification, you can further en-hance your skills and reputation by gaining the LPIC-2 and the coveted LPIC-3 certifications.

Let’s get started on Level 1!

xxvii

FM.indd 26 7/29/11 1:32 PM

Page 22: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxvi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

ACKNOWLEDGMENTS

The title page of this book lists Robb H. Tracy as its author. However, this attribution is deceiving. By no means was this a one-person job. Behind every book is a team of indi-viduals who rarely get the credit they deserve. They are the unsung heroes who make sure the job gets done.

First, I would also like to acknowledge the efforts of the production team behind this book. These folks were the glue that kept everything together. Thanks to Timothy Green for giving me the opportunity to write this book. I appreciate your confidence in me! Thanks to Stephanie Evans for managing the development process. No matter the time of day, Steph was always there with the information I needed. Thanks, Steph! Thanks also to Emilia Thiuri for helping me through the final review process. Her expe-rienced eyes are the reason this title looks good.

Finally, a huge thank you to Brian Barber. Brian reviewed each and every word and exercise step in this book for technical accuracy. His efforts kept me honest and were absolutely invaluable, dramatically increasing the overall quality of this title. Brian spent many late nights testing the lab exercises in this book, ensuring that you have a successful experience. Thanks, Brian!

xxvii

FM.indd 27 7/29/11 1:32 PM

Page 23: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

INTRODUCTION

We first need to introduce you to the nuts and bolts of this book and the LPIC-1/Comp-TIA Linux+ certification program. Let’s take a look at the following:

• Whothisbookisfor

• Howthisbookisorganized

• SpecialfeaturesoftheAll-in-OneCertificationseries

• TheLPIC-1/CompTIALinux+certificationexams

• TipsforsucceedingontheLPIC-1/CompTIALinux+certificationexams

Let’s begin by discussing whom this book is for.

Who This Book Is ForBefore you start this book, you need to be aware that I have two primary goals in mind as I write:

• TohelpyouprepareforandpasstheLPIC-1/CompTIALinux+examsofferedby CompTIA.

• Toprovideyouwiththeextraskillsandknowledgeyouneedtobesuccessfulon the job after you are certified.

Essentially, when we’re done here I want you to be able to do more than just recite facts. I want you to be able to walk the walk and talk the talk. I want you to be able to actually do the job once hired.

To accomplish this, we’re going to focus heavily on the core Linux knowledge and skills in this book required by the LPIC-1/CompTIA Linux+ certification. You need to already have a strong computing background before starting, including

• Managingcomputerhardware.Youshouldbeabletoinstallnewperipheraldevices, configure system resources, and troubleshoot basic hardware-related problems. For example, if someone were to hand you several memory modules and ask you to install them in a PC system, you should know exactly what to do. You should be familiar with the following:

• PCcasesandpowersupplies

• Motherboards

• Expansionslotsandexpansionboards

• CPUsandmemory

• Storagedevicessuchasharddrives,floppydrives,opticaldrives, and USB drives

xxix

FM.indd 29 7/29/11 1:32 PM

Page 24: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxx

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

• Videoboardsandmonitors

• Peripheraldevicessuchasprinters,scanners,anddigitalcameras

• Implementingandmanagingcomputernetworks.Youshouldbeabletoset up a network switch, install and configure network interface cards, and connect everything together with cabling. I’m going to assume you are familiar with the following:

• Commonnetworkingtopologies(suchasstar,bus,andring)

• CommonnetworkingcomponentssuchasNICs,cables,routers,and hubs/switches

• Commonnetworkingprotocols(suchasIP,IPX,TCP,UDP,andNetBIOS)

• Commonnetworkingservices,suchasFTPservers,webservers,and mail servers

If possible, CompTIA recommends that you have your A+ and Network+ certifica-tions under your belt (or have equivalent experience in the field) before starting this book. These two certification programs will provide you with the hardware and net-working background you need to be successful in your LPIC-1/CompTIA Linux+ certi-fication program.

If you have this background, you’re ready to roll! Let’s next discuss how this book is organized to accomplish its two main goals.

How This Book Is OrganizedI love CompTIA certification programs. They go the extra mile to make sure their certifi-cations truly reflect current trends in the information technology industry, and the LPIC-1/CompTIA Linux+ certification is no exception. Working in partnership with the Linux Professional Institute (LPI), CompTIA has defined the Linux+ certification by publish-ing objectives that list the skills and knowledge that a certified person should have.

These objectives, as currently published, are organized by topic. They aren’t orga-nized into a logical instructional flow. As you read through this book, you’ll quickly notice that I don’t address the LPIC-1/CompTIA Linux+ objectives in the same order as they are published by CompTIA. All of the objectives are covered; however, I’ve reorga-nized them such that we start with the most basic Linux concepts first. Then, as we progress through the course, we’ll address increasingly more advanced Linux+ objec-tives, building upon the skills and knowledge covered in preceding chapters.

Special Features of the All-in-One Certification SeriesTo make our exam guides more useful and a pleasure to read, we have designed the All-in-One Certification series to include several conventions.

FM.indd 30 7/29/11 1:32 PM

Page 25: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxx

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Introduction

xxxi

IconsTo alert you to an important bit of advice, a shortcut, or a pitfall, you’ll occasionally see Notes, Tips, Cautions, and Exam Tips peppered throughout the text.

NOTE Notes offer nuggets of especially helpful stuff, background explanations, and information. They also define terms occasionally.

TIP Tips provide suggestions and nuances to help you learn to finesse your job. Take a tip from us and read the Tips carefully.

CAUTION When you see a Caution, pay special attention. Cautions appear when you have to make a crucial choice or when you are about to undertake something that may have ramifications you might not immediately anticipate. Read them now so that you don’t have regrets later.

EXAM TIP Exam Tips give you special advice or may provide information specifically related to preparing for the exam itself.

End-of-Chapter Reviews and Chapter TestsAn important part of this book comes at the end of each chapter, where you will find a brief review of the high points along with a series of questions followed by the answers to those questions. Each question is in multiple-choice format. The answers provided also include a small discussion explaining why the correct answer actually is the correct answer.

The questions are provided as a study aid to you, the reader and prospective LPIC-1/CompTIA Linux+ exam taker. We obviously can’t guarantee that if you answer all of our questions correctly you will absolutely pass the certification exams. Instead, what we can guarantee is that the questions will provide you with an idea about how ready you are for the exams.

The CD-ROMLPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide (LPIC-1/LX0-101 & LX0-102) provides you with a CD-ROM containing even more test questions and their an-swers to help you prepare for the certification exam. Read more about the companion CD-ROM in Appendix B.

FM.indd 31 7/29/11 1:32 PM

Page 26: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

The LPIC-1/CompTIA Linux+ Certification ExamsNow that you understand how this book is organized, it’s time for you to become fa-miliar with the LPIC-1/CompTIA Linux+ certification program and its associated ex-ams. Let’s review the following:

• AbouttheLPIC-1/CompTIALinux+certification

• TakingtheLPIC-1/CompTIALinux+exams

• Exammakeup

About the LPIC-1/CompTIA Linux+ CertificationThe LPIC-1/CompTIA Linux+ certification is an excellent program! It is a vendor-neu-tral certification designed and administered by the Computing Technology Industry Association, affectionately known as CompTIA. The current version was developed by merging two very popular and well-respected Linux certifications together: LPI’s LPIC-1 certification and CompTIA’s Linux+ certification. Because they are basically the same certification now, you’ll see me use the term “LPIC-1/CompTIA Linux+ certification” throughout this book. In fact, if you pass your Linux+ exams, you can also receive your LPIC-1 certification by simply submitting your results to LPI.

The LPIC-1/CompTIA Linux+ certification is considered vendor-neutral because the exams aren’t based on one particular vendor’s hardware or software. This is somewhat unique in the information technology industry. Many IT certification programs are cen-tered on one particular vendor’s hardware or software, such as Microsoft’s Certified System Engineer (MCSE) certification, Novell’s Certified Linux Engineer (CLE) certifi-cation, or Red Hat’s Certified Engineer (RHCE) certification.

The LPIC-1/CompTIA Linux+ certification, on the other hand, is designed to verify your knowledge and skills with the Linux operating system in general, not on any one particular distribution. According to CompTIA,

“CompTIA Linux+ Powered by LPI is a high-stakes, vendor-neutral certification that vali-dates the fundamental knowledge and skills required of junior Linux administrators… Candi-date job roles include junior Linux administrator, junior network administrator, systems administrator, Linux database administrator and web administrator. Companies such as Dell, HP, IBM, Lenovo and Xerox recommend or require CompTIA Linux+.”

To verify your knowledge, CompTIA requires you to take two exams to earn your certification: LX0-101 and LX0-102. The LX0-101 exam covers the following general knowledge areas:

• Linuxsystemarchitecture

• Linuxinstallationandpackagemanagement

• GNUandUNIXcommands

• Hardwaredevices

• LinuxfilesystemsandtheFilesystemHierarchyStandard.

FM.indd 32 7/29/11 1:32 PM

Page 27: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Introduction

xxxiiiThe LX0-102 exam covers the following general knowledge areas:

• Shells

• Scriptinganddatamanagement

• Userinterfacesanddesktops

• Administrativetasks

• Essentialsystemservices

• Networkingfundamentals

• Security

CompTIA has published sets of objectives for both exams that together define the LPIC-1/CompTIA Linux+ certification. These objectives specify what a junior Linux system admin should know and be able to do. You can view the LPIC-1/CompTIA Linux+ objec-tives at http://certification.comptia.org/. All of the items on the Linux+ exams are based on these objectives. If you’re going to be LPIC-1/CompTIA Linux+ certified, then you have to be able to do the tasks contained in these objectives. As we go through this book, you’ll see that the complete list of LPIC-1/CompTIA Linux+ objectives is quite extensive.

In the latest version of the LPIC-1/CompTIA Linux+ certification, you have the op-tion of forwarding your exam results to the Linux Professional Institute (LPI). Passing both the LX0-101 and LX0-102 exams allows you to become LPIC level 1 certified as well as Linux+ certified.

Let’s talk about the exams in a little more detail.

Taking the LPIC-1/CompTIA Linux+ ExamsThe LPIC-1/CompTIA Linux+ exams are timed exams delivered electronically on a computer. Each exam is composed of 60 questions, and you will have 90 minutes per exam to complete them.

NOTE You may actually see more than 60 questions on your exams. If this happens, it’s because CompTIA has slipped a few beta test items into your exam to evaluate them. In this situation, you should be automatically given extra time on the exam to accommodate the extra items.

The exam interface is fairly straightforward. Items are displayed one at a time on the screen. You are presented with a question along with a series of responses. You mark the appropriate response and then go to the next question.

Each exam is composed primarily of multiple-choice items. This testing format presents you with a question and asks you to mark the correct answer from a list of choices. Most of the multiple-choice questions require only one answer; however, some will require you to select multiple correct responses from the list displayed. If this is the case, the test question will end with the text “(Choose x.),” where x is the number of responses you should mark.

FM.indd 33 7/29/11 1:32 PM

Page 28: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxiv

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

After you complete your exam, the computer will immediately evaluate it and your score will be printed out. To pass, you need a minimum score of 500 points out of a possible 800. Hopefully, you will pass your exams on the first try. However, if you don’t, your score printout will list the objectives where you missed questions. You can use this information to review and prepare yourself to retake the exam.

To make the exams globally available, CompTIA administers the LPIC-1/CompTIA Linux+ exams through two testing partners:

• Prometric www.prometric.com

• Pearson VUE www.vue.com

To sign up for the LPIC-1/ Linux+ exams, choose one of these testing partners and visit their web site. There you will find a link that will help you locate a testing center near you. Most community and technical colleges are authorized testing centers. Just specify the exam you want to take and your locale information. You will then be pro-vided with a list of testing centers near you, as shown in Figure 1.

YoucanthenusethePrometricorVUEwebsitetoscheduleyourexamsandpayyourfees. You can also call either provider directly and schedule your exams over the phone. Be aware that they will need to verify your identity before they can sign you up, so be prepared to share your Social Security number when you call or log on. The test provider will send you a confirmation e-mail listing the date, time, and location of your exam.

On the day of the test, be sure you allow adequate travel time. You never know when you will run into a traffic jam. In addition, you should try to show up early enough to find a parking spot and walk to the testing center. If you’re taking your exams at a community college, you may find that you have to walk a very long distance to get from the parking lot to the building where the exams are delivered. The last thing you need right before your exam is to feel rushed and stressed!

Figure-1 Locating a testing center near you

FM.indd 34 7/29/11 1:32 PM

Page 29: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxiv

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Introduction

xxxvWhen you check in at the testing center, you will be required to show two forms of

identification, one of which must have your photo on it. The following are acceptable forms of ID:

• Driver’slicense

• SocialSecuritycard

• Creditcard

• StudentIDcard

• MilitaryIDcard

• State-issuedIDcard

Be warned that, when you check in, you must surrender your cell phone, iPod, tab-let, laptop, or any other electronic devices to the test proctor. You’re not allowed to take any reference materials into the exam room, including blank paper. Most testing cen-ters will provide you with note-taking materials that must remain in the room where the test is being administered. Some testing centers will provide you with paper and a pencil; others may provide a small whiteboard slate with an erasable pen.

Let’s now look at the composition of the LPIC-1/ Linux+ exams.

Exam MakeupEach exam is divided up into several categories, which CompTIA calls domains. The

first exam is number LX0-101. The knowledge domains covered on the first exam are shown in Table 1.

The knowledge domains covered on the second exam are shown in Table 2.As you can see in the tables, some domains are tested more heavily than others.

When studying, be sure to pay special attention to those domains with the highest per-centage of exam questions!

With this in mind, let’s now discuss how to prepare for the LPIC-1/CompTIA Linux+ exams.

Domain % of Exam

101 System Architecture 14

102 Linux Installation and Package Management 18

103 GNU and UNIX Commands 43

104 Devices, Linux Filesystems, Filesystem Hierarchy Standard 25

Total 100

Table-1 LX0-101 Exam Domains

FM.indd 35 7/29/11 1:32 PM

Page 30: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxvi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Tips for Succeeding on the Linux+ Certification ExamsI’ll never forget the first time I took an IT certification exam back in the early 1990s. I was so nervous that I almost couldn’t function. Fortunately, the exam went very well and I passed it handily. Over the last decade, I’ve helped a lot of folks prepare them-selves for a variety of certification exams. I’ve even written a number of industry certifi-cation exams myself. As a result, I’ve learned a number of things that you can do to increase the likelihood that you will pass your exam. We’ll discuss the following here:

• Preparingfortheexams

• Takingtheexams

Let’s begin by learning how you can prepare yourself for the LPIC-1/CompTIA Linux+ exams.

Preparing for the ExamsThe most important thing you can do to prepare for your LPIC-1/CompTIA Linux+ exams is to thoroughly study. No tip, no trick, no strategy can compensate for a lack of study. The goal is to move the information you need to pass the exams into your long-term memory. Following are some study tips that can help you prepare for your certifi-cation exams.

One to Two Months Before Your Exams• ScheduleyourLPIC-1/CompTIALinux+exams.Ideally,youshouldschedule

them to take place about 30–60 days after you begin this book. If you don’t give yourself a deadline, you probably will never “get around” to studying for and taking the exams.

• Paceyourself.Don’ttrytocramfortheexamsthenightbefore.Thisisaverycommon mistake made by many students. (I did this myself in college.) Cramming rarely works, because your short-term memory can only hold a limited amount of information. All that stuff you’re trying to cram into your

Domain % of Exam

105 Shells, Scripting, and Data Management 17

106 User Interfaces and Desktops 8

107 Administrative Tasks 20

108 Essential System Services 17

109 Networking Fundamentals 23

110 Security 15

Total 100

Table-2 LX0-102 Exam Domains

FM.indd 36 7/29/11 1:32 PM

Page 31: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxvi

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Introduction

xxxviishort-term memory gets lost. Instead, successful test-takers spend a good deal of time loading information into their long-term memory. You can do this by setting a goal to read a certain number of pages or chapters each day and sticking to it.

• Takenotes!Asyoureadeachchapter,writedownimportantinformationthatstands out to you. Writing this down helps reinforce the information, moving it from short-term memory into long-term memory in your brain. It also provides you with a valuable review resource.

• Dothelabexercises,eventhesimpleones.Doingthelabexerciseshelpsyoulearn the practical implementation of the conceptual skills and knowledge presented in each chapter.

• Tacklethepracticequestionsforeachchapter.Afteryoureadachapter,getablank piece of paper and run through the questions, recording your responses on the paper. (Don’t write in the book! You’ll want it to be pristine for later study sessions.) Check your answers and review the topics you missed.

• ReviewtheSummaryandAcceleratedReviewafteryoucompleteeachchapter.

Two to Three Days Before Your Exam• Reviewyournotes.

• Reviewthepracticequestionsattheendofeachchapter.Reviewanytopicsthat you are still struggling with.

• Repeatthelabexercisesforeachchapter.Thistime,however,trytocompletethe exercises without looking at the steps in the book.

The Night Before Your Exam• Relax!Beingwellrestedisakeytoperformingwellonyourexams.Don’tget

so worked up and nervous that you can’t sleep the night before your exams. Get to bed at a reasonable hour.

• Reviewyournotes.

• ReviewtheSummaryandAcceleratedReviewagainforeachchapter.Repetition is the key to retention!

The Morning of Your Exam• Eatagoodbreakfast.Yourbrainrequiresatremendousamountofcaloriesto

operate. Give it what it needs!

• Reviewyournotes.

• ReviewtheSummaryandAcceleratedReviewonceagainforeachchapter.DidI mention that repetition is the key to retention?

• Runthroughyourpracticequestionsonemoretimeforeachchapter.

• Allowyourselfplentyoftimetogettothetestingcenter.Don’tgetstressedoutby being late.

FM.indd 37 7/29/11 1:32 PM

Page 32: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxviii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

What we’re trying to do is upload the information you need to pass your tests into your long-term memory through repetition and practice. Then, shortly before the ex-ams, we’re exercising the brain by retrieving that stored information and bringing it to the forefront of your thoughts (kind of like loading data from a hard drive into system RAM) so that it is ready and available when you take the test.

With this in mind, let’s review some of the key “gotchas” certification candidates have observed about the LPIC-1/CompTIA Linux+ exams:

• Theexamshaveareputationforbeingnit-pickyoncommandoptions.Infact,some candidates have criticized the exams for focusing too much on vague or obscure command options that aren’t used often. We’ve tried to cover the commands options that we think you’ll be tested on in this book. However, we obviously don’t have access to the exam banks, so we can’t guarantee that all of the command options that you’ll see on the exams are addressed here. Covering all options for all of the commands isn’t realistic, as it would easily double the page count of this book (and put you to sleep). Therefore, I strongly recommend that you review the man pages for all of the commands we’ve covered in this book and review their various options.

• YoumustknowbothRPMandDebianpackagemanagementsystemsforyour LPIC-1/CompTIA Linux+ exams. In earlier versions of the certification, you could pick which one you wanted to be tested on. Not so now. You are expected to be familiar with both.

• There’ssomedebateaboutwhetherit’sbesttotakeyourexamsoneatatimeor together all at once. The general consensus is that the LX0-101 exam is the more difficult of the two. Accordingly, my recommendation is that you take the exams separately and that you take the LX0-101 exam first. Don’t be alarmed if you have to retake the LX0-101 exam to pass it. The reality is that not many candidates pass it the first time. However, after passing the LX0-101 exam many candidates report that the LX0-102 exam is noticeably less difficult. You must take both exams within five years of each other in order to be certified.

• TheaveragescoreontheLPIC-1/CompTIALinux+examsisaround480.Remember that a 500 score is required to pass. This statistic should tell you that these are very difficult exams! A lot of candidates (about half) fail. According the LPI web site, this is done deliberately. Their goal is to weed out less experienced Linux admins from those who know their stuff.

EXAM TIP From my observations, LPIC-1/CompTIA Linux+ certification candidates who study their shell commands and associated options (especially some of the more obscure ones) are the candidates who pass!

Next, let’s talk about some strategies you should keep in mind when actually taking the exams.

FM.indd 38 7/29/11 1:32 PM

Page 33: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xxxviii

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

Introduction

xxxix

Taking the ExamsAs I mentioned earlier, I’ve written a number of industry certification exams in addition to developing training materials for them. Because I’ve done this, I have some insights as to what goes on inside the devious minds of exam developers. I’m going to share them with you here:

• Carefully read the text of each question (called the stem). Some of the information in the stem is superfluous and intended to distract you. However, the question stem usually contains one or two critical pieces of information that influence the correct answer. If your testing center provides you with writing materials (and they should), I suggest you quickly jot down the key points from the stem.

• Carefully read each response. Don’t just skim them. Exam authors deliberately include responses that are almost correct, but not quite. (We call them red herrings.) The intent is to distract you away from the real answer. I know it sounds sneaky, but the intent is to make the exam such that you can’t divine the correct answer without really knowing your stuff.

• Eliminate responses that are obviously wrong. Each item will have one or more responses that are blatantly wrong. (Usually, it’s because the exam author couldn’t think of anything better to include as a response.) Eliminate these answers and focus only on the responses that could be correct.

• Make your best choice and move on. My experience has been that your first impression is usually the correct one. If you agonize over the answers, you can over-think the question and end up picking the wrong response. You also waste valuable time. After carefully reading the question and each response, go with your intuition and then go on to the next item.

• If you get stuck on a particularly difficult item, don’t waste a lot of time trying to figure out the right answer. You can skip the item and come back to it later. Many students get obsessed with finding the right answer to a particularly difficult question and end up with insufficient time to answer the rest of the items on the exam. Answer the questions that you can and then come back to the difficult questions that will require more time.

After you finish your exams, your results will be automatically printed out for you. The report will be embossed by your test proctor to certify the results. Don’t lose these reports; it’s the only hard copy you will receive! I’ve heard of candidates who’ve had to send a paper copy of their exam report back to CompTIA when technical problems prevented their test results from being transmitted correctly.

The report will display your performance on each section of the exams. The LPIC-1/CompTIA Linux+ exams are pass-fail. If you score 500 or better, you pass! A candidate with a score of 577 is every bit as certified as a candidate with a score of 798.

FM.indd 39 7/29/11 1:32 PM

Page 34: ALL IN ONE LPIC-1/CompTIA Linux+ · PDF fileALL IN ONE LPIC-1/CompTIA Linux+™ Certification EXAM GUIDE (Exams LPIC-1/LX0-101 & LX0-102) Robb H. Tracy New York • Chicago • San

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide

xl

All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3 All-in-1 /LPIC-1/CompTIA Linux+ Certification Exam Guide (Exam LPIC-1/LX0-101 & LX0-102) / Tracy / 157-3

If you didn’t pass, you can use the information on your report to identify the areas where you need to study. You can retake the exams immediately, if you wish. However, there are two things you need to keep in mind before you do this:

• Youhavetopayfullpricefortheretake.

• Theretakeexamprobablywon’tbethesameasthefirst.CompTIApublishesmultiple forms of the LPIC-1/CompTIA Linux+ exams.

However, if you don’t pass again, you must wait at least 14 days before you will be allowed to take the exam a third time.

If you fail, I suggest that you step back, take a deep breath, go home, and study up on the items you missed. Then schedule your retake within a day or two. If you wait any longer than that, your mind will probably go “cold” and you may need to go through the entire preparation process again from scratch.

FM.indd 40 7/29/11 1:32 PM