Download; While Red Hat Linux Was Sold As a “Boxed Set” with Cds and Manuals, Red Hat Now Leaves This to Third-Party Vendors
Total Page:16
File Type:pdf, Size:1020Kb
Version 4.0 Introduction to Linux for Users and Administrators $ echo tux tux $ ls hallo.c hallo.o $ /bin/su - Password: tuxcademy – Linux and Open Source learning materials for everyone www.tuxcademy.org [email protected] ⋅ This training manual is designed to correspond to the objectives of the LPI-101 (LPIC-1, version 4.0) certification exam promulgated by the Linux Professional Institute. Further details are available in Appendix C. The Linux Professional Institute does not endorse specific exam preparation materials or tech- niques. For details, refer to [email protected]. The tuxcademy project aims to supply freely available high-quality training materials on Linux and Open Source topics – for self-study, school, higher and continuing education and professional training. Please visit http://www.tuxcademy.org/! Do contact us with questions or suggestions. Introduction to Linux for Users and Administrators Revision: grd1:62f570f98f89998d:2015-08-04 grd1:be27bba8095b329b:2015-08-04 1–11, B–C grd1:EF6EC05fegg6iuNkQRlDOJ © 2015 Linup Front GmbH Darmstadt, Germany © 2015 tuxcademy (Anselm Lingnau) Darmstadt, Germany http://www.tuxcademy.org [email protected] ⋅ Linux penguin “Tux” © Larry Ewing (CC-BY licence) All representations and information contained in this document have been com- piled to the best of our knowledge and carefully tested. However, mistakes cannot be ruled out completely. To the extent of applicable law, the authors and the tux- cademy project 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 docu- ment, 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 document is published under the “Creative Commons-BY-SA 4.0 Interna- tional” licence. You may copy and distribute it and make it publically available as long as the following conditions are met: Attribution You must make clear that this document is a product of the tux- cademy project. Share-Alike You may alter, remix, extend, or translate this document or modify or build on it in other ways, as long as you make your contributions available under the same licence as the original. Further information and the full legal license grant may be found at http://creativecommons.org/licenses/by-sa/4.0/ Authors: Tobias Elsner, Anselm Lingnau Technical Editor: Anselm Lingnau [email protected] ⟨ ⟩ English Translation: Anselm Lingnau Typeset in Palatino, Optima and DejaVu Sans Mono Contents 1 Introduction 13 1.1 What is Linux? . 14 1.2 Linux History . 14 1.3 Free Software, “Open Source” and the GPL . 16 1.4 Linux—The Kernel . 19 1.5 Linux Properties . 21 1.6 Linux Distributions . 24 2 Using the Linux System 29 2.1 Logging In and Out . 30 2.2 Switching On and Off . 32 2.3 The System Administrator. 32 3 Who’s Afraid Of The Big Bad Shell? 35 3.1 Why? . 36 3.1.1 What Is The Shell? . 36 3.2 Commands . .$ . echo. tux. 37 3.2.1 Why Commands?. .tux. 37 3.2.2 Command Structure. .$ . ls. 38 3.2.3 Command Types . .hallo.c. 39 3.2.4 Even More Rules . .hallo.o. 39 4 Getting Help$ /bin/su - 41 4.1 Self-Help . .Password:. 42 4.2 The help Command and the --help Option . 42 4.3 The On-Line Manual . 42 4.3.1 Overview . 42 4.3.2 Structure . 43 4.3.3 Chapters . 44 4.3.4 Displaying Manual Pages . 44 4.4 Info Pages . 45 4.5 HOWTOs. 46 4.6 Further Information Sources . 46 5 Editors: vi and emacs 49 5.1 Editors. 50 5.2 The Standard—vi . 50 5.2.1 Overview . 50 5.2.2 Basic Functions . 51 5.2.3 Extended Commands . 54 5.3 The Challenger—Emacs . 56 5.3.1 Overview . 56 5.3.2 Basic Functions . 57 5.3.3 Extended Functions . 59 5.4 Other Editors . 61 4 Contents 6 Files: Care and Feeding 63 6.1 File and Path Names . 64 6.1.1 File Names . 64 6.1.2 Directories . 65 6.1.3 Absolute and Relative Path Names . 66 6.2 Directory Commands . 67 6.2.1 The Current Directory: cd & Co. 67 6.2.2 Listing Files and Directories—ls . 68 6.2.3 Creating and Deleting Directories: mkdir and rmdir . 69 6.3 File Search Patterns . 70 6.3.1 Simple Search Patterns . 70 6.3.2 Character Classes . 72 6.3.3 Braces . 73 6.4 Handling Files . 74 6.4.1 Copying, Moving and Deleting—cp and Friends. 74 6.4.2 Linking Files—ln and ln -s . 76 6.4.3 Displaying File Content—more and less . 80 6.4.4 Searching Files—find . 81 6.4.5 Finding Files Quickly—locate and slocate . 84 7 Regular Expressions 87 7.1 Regular Expressions: The Basics . 88 7.1.1 Regular Expressions: Extras . 88 7.2 Searching Files for Text—grep . 89 8 Standard I/O and Filter Commands 93 8.1 I/O Redirection and Command Pipelines . 94 8.1.1 Standard Channels . 94 8.1.2 Redirecting Standard Channels . 95 8.1.3 Command Pipelines . 98 8.2 Filter Commands . 99 8.3 Reading and Writing Files . 100 8.3.1 Outputting and Concatenating Text Files—cat . 100 8.3.2 Beginning and End—head and tail . 100 8.4 Data Management . 101 8.4.1 Sorted Files—sort and uniq . 101 8.4.2 Columns and Fields—cut, paste etc. 106 9 More About The Shell 111 9.1 Simple Commands: sleep, echo, and date . 112 9.2 Shell Variables and The Environment. 113 9.3 Command Types—Reloaded . 115 9.4 The Shell As A Convenient Tool. 116 9.5 Commands From A File . 119 9.6 The Shell As A Programming Language. 120 10 The File System 125 10.1 Terms . 126 10.2 File Types. 126 10.3 The Linux Directory Tree . 127 10.4 Directory Tree and File Systems. 135 11 Archiving and Compressing Files 137 11.1 Archival and Compression . 138 11.2 Archiving Files Using tar . 139 11.3 Compressing Files with gzip . 142 11.4 Compressing Files with bzip2 . 143 11.5 Archiving and Compressing Files Using zip and unzip . 144 5 A Sample Solutions 149 B Example Files 159 C LPIC-1 Certification 163 C.1 Overview. 163 C.2 Exam LPI-101 . 163 C.3 LPI Objectives In This Manual . 164 D Command Index 169 Index 173 List of Tables 4.1 Manual page sections . 43 4.2 Manual Page Topics . 44 5.1 Insert-mode commands for vi ...................... 52 5.2 Cursor positioning commands in vi ................... 53 5.3 Editing commands in vi ......................... 54 5.4 Replacement commands in vi ...................... 54 5.5 ex commands in vi ............................. 56 5.6 Possible buffer states in emacs ....................... 57 5.7 Cursor movement commands in emacs ................. 59 5.8 Deletion commands in emacs ....................... 59 5.9 Text-correcting commands in emacs ................... 60 6.1 Some file type designations in ls .................... 68 6.2 Some ls options . 68 6.3 Options for cp ............................... 74 6.4 Keyboard commands for more ......................$ echo tux 80 6.5 Keyboard commands for less ......................tux 81 6.6 Test conditions for find ..........................$ ls 82 6.7 Logical operators for find .........................hallo.c 83 7.1 Regular expression support . .hallo.o . 90 7.2 Options for grep (selected) . .$ . ./bin/su . .- . 90 Password: 8.1 Standard channels on Linux . 95 8.2 Options for cat (selection) . 100 8.3 Options for sort (selection) . 104 9.1 Important Shell Variables . 114 9.2 Key Strokes within bash .......................... 118 10.1 Linux file types . 126 10.2 Directory division according to the FHS . 134 List of Figures 1.1 Ken Thompson and Dennis Ritchie with a PDP-11 . 15 1.2 Linux development . 16 1.3 Organizational structure of the Debian project . 25 2.1 The login screens of some common Linux distributions . 30 2.2 Running programs as a different user in KDE . 33 4.1 A manual page . 44 5.1 vi’s modes . 52 5.2 The emacs launch screen . 58 8.1 Standard channels on Linux . 94 8.2 The tee command . 98 10.1 Content of the root directory (SUSE) . 128 $ echo tux tux $ ls hallo.c hallo.o $ /bin/su - Password: Preface This manual is an introduction to the use of Linux. Participants will not just learn how to operate the system according to instructions, but will receive solid funda- mental knowledge about Linux, to serve as a basis for further study. The course is directed towards computer users with little or no previous expo- sure to Linux. Knowledge of other operating systems is helpful but not a prereq- uisite. Ambitious users as well as system administrators will be learning how to make the most of the Linux operating system. Having studied this manual, participants will be able to use the Linux oper- ating system on an elementary basis. They will be able to work on the Linux command line and be familiar with the most important tools. Completion of this course or equivalent knowledge is necessary for more advanced Linux courses and for Linux Professional Institute certification. This courseware package is designed to support the training course as effi- ciently as possible, by presenting the material in a dense, extensive format for reading along, revision or preparation.