Linux Essentials//The LPI Introductory Programme
Total Page:16
File Type:pdf, Size:1020Kb
Linux Essentials The LPI Introductory Programme Linup Front GmbH Postfach 10 01 21 64201 Darmstadt Germany ⋅ ⋅ Telefon +49(0) 6151 9067 0 Telefax +49(0) 6151 9067 299 ⋅ www.linupfront.de The Linux Essentials logo does not imply that this training manual was checked or endorsed by the Linux Professional Institute (LPI). The LPI does not endorse specific exam preparation methods or mate- rials. Further information is available from http://www.lpi.org/. Linux Essentials The LPI Introductory Programme Revision: lxes:54d12fc97784892b:2012-05-11 adm1:62522705f117f22a:2012-05-11 13–14 grd1:822549a3d13cac8e:2012-05-11 4–11, B lxes:7ef0d045e4cceb6c:2012-05-11 1–3, 12, 15 lxes:HacJlmLhsTatn7YZSqqfhF © 2012 Linup Front GmbH Darmstadt http://www.linupfront.de [email protected] ⋅ Authors: Tobias Elsner, Thomas Erker, Anselm Lingnau Technical Editor: Anselm Lingnau [email protected] ⟨ ⟩ Typeset in Palatino, Optima and DejaVu Sans Mono About Ourselves Who We Are Since 2001, Linup Front GmbH offers training materials and instructor services for Linux and free/open-source software—competently and re- liably, in Germany and abroad. As a leading enterprise we stand for uncompromising quality, customer-oriented flexibility, and fair prices. Linux Essentials You can download the Linux Essentials app, in English and German, from the Google Play Store. A freely redistributable PDF version of this training manual for printing and giving away is available from Linup Front GmbH’s online shop at http://shop.linupfront.com/. In our online shop, we also offer additional training manuals for Linux and FLOSS topics. We ship printed manuals (within Germany and the EU) and also deliver manuals in PDF and e-book formats. We Would Like To Hear From You! We are happy to hear your comments and suggestions. Get in touch by e-mail to [email protected]. More ways of reaching us are listed in our online shop. 3 Important All representations and information contained in this document have been compiled to the best of our knowledge and carefully tested. How- ever, mistakes cannot be ruled out completely. The authors and Linup Front GmbH assume no responsibility or liability resulting in any way from the use of this material or parts of it or from any violation of the rights of third parties. Reproduction of trade marks, service marks and similar monikers in this document, even if not specially marked, does not imply the stipulation that these may be freely usable according to trade mark protection laws. All trade marks are used without a warranty of free usability and may be registered trade marks of third parties. This work is protected by copyright. All rights, particularly those of translations to foreign languages, are reserved. No part of this docu- ment may be photocopied or otherwise reproduced or translated into a machine-readable representation without the express permission of Linup Front GmbH. Machine-readable representations of this document, particularly HTML or PDF versions, are made available for personal use only and may not be distributed without the express permission of Linup Front GmbH. The same restrictions apply to printouts of such representations. 4 Contents 1 Computers, Software and Operating Systems 16 1.1 What Is A Computer, Anyway? . 17 1.2 Components Of A Computer . 20 1.3 Software . 28 1.4 The Most Important Operating Systems. 30 1.4.1 Windows And OS X . 30 1.4.2 Linux . 32 1.4.3 More Differences And Similarities. 33 1.5 Summary. 35 2 Linux and Free Software 37 2.1 Linux: A Success Story . 38 2.2 Free Or Open Source? . 44 2.2.1 Copyright And “Free Software” . 44 2.2.2 Licences . 49 2.2.3 The GPL . 52 2.2.4 Other Licences . 56 2.3 Important Free Software . 61 2.3.1 Overview . 61 2.4 Office and Productivity Tools . 62 2.4.1 Graphics and Multimedia Tools . 63 2.4.2 Internet Services . 65 2.4.3 Infrastructure Software. 65 2.4.4 Programming Languages and Development . 66 2.5 Important Linux Distributions . 68 2.5.1 Overview . 68 2.5.2 Red Hat . 69 2.5.3 SUSE . 70 2.5.4 Debian . 72 2.5.5 Ubuntu . 74 2.5.6 Others . 75 2.5.7 Differences and Similarities . 76 3 First Steps with Linux 82 3.1 Logging In and Out . 83 3.2 Desktop Environment and Browser . 87 3.2.1 Graphical Desktop Environments . 87 3.2.2 Browsers . 89 3.2.3 Terminals and Shells. 90 3.3 Creating and Modifying Text Files . 92 4 Who’s Afraid Of The Big Bad Shell? 101 4.1 Why? . 102 4.1.1 What Is The Shell? . 103 4.2 Commands . 106 4.2.1 Why Commands?. 106 4.2.2 Command Structure. 106 4.2.3 Command Types . 108 4.2.4 Even More Rules . 110 5 Getting Help 113 5.1 Self-Help . 114 5.2 The help Command and the --help Option . 115 5.3 The On-Line Manual . 116 5.3.1 Overview . 116 5.3.2 Structure . 117 5.3.3 Chapters . 118 5.3.4 Displaying Manual Pages . 119 5.4 Info Pages . 122 5.5 HOWTOs. 124 5.6 Further Information Sources . 125 6 6 Files: Care and Feeding 130 6.1 File and Path Names . 131 6.1.1 File Names . 131 6.1.2 Directories . 134 6.1.3 Absolute and Relative Path Names . 135 6.2 Directory Commands . 138 6.2.1 The Current Directory: cd & Co. 138 6.2.2 Listing Files and Directories—ls . 139 6.2.3 Creating and Deleting Directories: mkdir and rmdir . 143 6.3 File Search Patterns . 145 6.3.1 Simple Search Patterns . 145 6.3.2 Character Classes. 147 6.3.3 Braces . 149 6.4 Handling Files . 151 6.4.1 Copying, Moving and Deleting—cp and Friends. 151 6.4.2 Linking Files—ln and ln -s . 155 6.4.3 Displaying File Content—more and less . 160 6.4.4 Searching Files—find . 162 6.4.5 Finding Files Quickly—locate and slocate . 167 7 Regular Expressions 173 7.1 Regular Expressions: The Basics . 174 7.1.1 Regular Expressions: Extras . 175 7.2 Searching Files for Text—grep . 178 8 Standard I/O and Filter Commands 184 8.1 I/O Redirection and Command Pipelines . 185 8.1.1 Standard Channels . 185 8.1.2 Redirecting Standard Channels . 188 8.1.3 Command Pipelines . 192 8.2 Filter Commands . 195 8.3 Reading and Writing Files . 197 8.3.1 Outputting and Concatenating Text Files—cat . 197 8.3.2 Beginning and End—head and tail . 198 7 8.4 Data Management . 201 8.4.1 Sorted Files—sort and uniq . 201 8.4.2 Columns and Fields—cut, paste etc. 210 9 More About The Shell 217 9.1 Simple Commands: sleep, echo, and date . 218 9.2 Shell Variables and The Environment. 221 9.3 Command Types – Reloaded . 224 9.4 The Shell As A Convenient Tool . 228 9.5 Commands From A File . 233 9.6 The Shell As A Programming Language. 235 10 The File System 244 10.1 Terms . 245 10.2 File Types. 247 10.3 The Linux Directory Tree . 249 10.4 Directory Tree and File Systems. 263 11 Archiving and Compressing Files 268 11.1 Archival and Compression . 269 11.2 Archiving Files Using tar . 271 11.3 Compressing Files with gzip . 277 11.4 Compressing Files with bzip2 . 280 11.5 Archiving and Compressing Files Using zip and unzip . 282 12 Introduction to System Administration 290 12.1 System Administration Basics . 291 12.2 System Configuration . 294 12.3 Processes . 297 12.4 Package Management . 304 13 User Administration 309 13.1 Basics . 310 13.1.1 Why Users? . 310 13.1.2 Users and Groups . 312 8 13.1.3 People and Pseudo-Users . 316 13.2 User and Group Information. 318 13.2.1 The /etc/passwd File . 318 13.2.2 The /etc/shadow File . 322 13.2.3 The /etc/group File . 327 13.2.4 The /etc/gshadow File . 328 13.3 Managing User Accounts and Group Information . 330 13.3.1 Creating User Accounts . 330 13.3.2 The passwd Command . 333 13.3.3 Deleting User Accounts . 336 13.3.4 Changing User Accounts and Group Assignment . 337 13.3.5 Changing User Information Directly—vipw . 338 13.3.6 Creating, Changing and Deleting Groups . 339 14 Access Control 344 14.1 The Linux Access Control System . 345 14.2 Access Control For Files And Directories . 346 14.2.1 The Basics . 346 14.2.2 Inspecting and Changing Access Permissions. 347 14.2.3 Specifying File Owners and Groups—chown and chgrp . 350 14.3 Process Ownership . 352 14.4 Special Permissions for Executable Files . 353 14.5 Special Permissions for Directories . 355 15 Linux Networking 361 15.1 Networking Basics . 362 15.1.1 Introduction and Protocols . 362 15.1.2 Addressing and Routing . 364 15.1.3 Names and the DNS. 368 15.1.4 IPv6 . 369 15.2 Linux As A Networking Client . 373 15.2.1 Requirements . 373 15.2.2 Troubleshooting . 375 A Sample Solutions 387 9 B Example Files 411 C Linux Essentials Certification 416 C.1 Exam Objective Overview . 417 C.2 Exam Objectives For Linux Essentials . 419 D Command Index 431 Index 436 10 List of Tables 2.1 Comparison of the most important Linux distributions (as of February, 2012) . 78 5.1 Manual page sections . 117 5.2 Manual Page Topics . 118 6.1 Some file type designations in ls .............