Linux Fundamentals Paul Cobbaut Linux Fundamentals Paul Cobbaut Lt-2.0
Total Page:16
File Type:pdf, Size:1020Kb
Linux Fundamentals Paul Cobbaut Linux Fundamentals Paul Cobbaut lt-2.0 Published Tue 17 Jul 2012 01:00:39 CEST Abstract This book is meant to be used in an instructor-led training. For self-study, the intent is to read this book next to a working Linux computer so you can immediately do every subject, practicing each command. This book is aimed at novice Linux system administrators (and might be interesting and useful for home users that want to know a bit more about their Linux system). However, this book is not meant as an introduction to Linux desktop applications like text editors, browsers, mail clients, multimedia or office applications. More information and free .pdf available at http://linux-training.be . Feel free to contact the author: • Paul Cobbaut: [email protected], http://www.linkedin.com/in/cobbaut Contributors to the Linux Training project are: • Serge van Ginderachter: [email protected], build scripts and infrastructure setup • Ywein Van den Brande: [email protected], license and legal sections • Hendrik De Vloed: [email protected], buildheader.pl script We'd also like to thank our reviewers: • Wouter Verhelst: [email protected], http://grep.be • Geert Goossens: [email protected], http://www.linkedin.com/in/geertgoossens • Elie De Brauwer: [email protected], http://www.de-brauwer.be • Christophe Vandeplas: [email protected], http://christophe.vandeplas.com • Bert Desmet: [email protected], http://blog.bdesmet.be • Rich Yonts: [email protected], Copyright 2007-2012 Netsec BVBA, Paul Cobbaut Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled 'GNU Free Documentation License'. Table of Contents I. introduction to Linux ........................................................................................ 1 1. Linux history ............................................................................................... 2 2. distributions ................................................................................................. 4 3. licensing ...................................................................................................... 6 4. getting Linux at home ............................................................................... 10 II. first steps on the command line .................................................................... 21 5. man pages ................................................................................................. 22 6. working with directories ........................................................................... 26 7. working with files ..................................................................................... 35 8. working with file contents ........................................................................ 44 9. the Linux file tree ..................................................................................... 51 III. shell expansion .............................................................................................. 72 10. commands and arguments ....................................................................... 73 11. control operators ..................................................................................... 83 12. variables .................................................................................................. 89 13. shell history ........................................................................................... 100 14. file globbing .......................................................................................... 106 IV. pipes and commands .................................................................................. 113 15. redirection and pipes ............................................................................. 114 16. filters ..................................................................................................... 123 17. basic Unix tools .................................................................................... 136 V. vi ..................................................................................................................... 145 18. Introduction to vi .................................................................................. 146 VI. scripting ....................................................................................................... 156 19. scripting introduction ............................................................................ 157 20. scripting loops ....................................................................................... 163 21. scripting parameters .............................................................................. 170 22. more scripting ....................................................................................... 178 VII. local user management ............................................................................. 186 23. users ...................................................................................................... 187 24. groups .................................................................................................... 207 VIII. file security ............................................................................................... 213 25. standard file permissions ...................................................................... 214 26. advanced file permissions ..................................................................... 225 27. access control lists ................................................................................ 231 28. file links ................................................................................................ 235 IX. Appendices ................................................................................................... 242 A. certifications ........................................................................................... 243 B. keyboard settings .................................................................................... 245 C. hardware ................................................................................................. 247 Index .................................................................................................................... 251 iii List of Tables 18.1. getting to command mode ......................................................................... 147 18.2. switch to insert mode ................................................................................. 147 18.3. replace and delete ...................................................................................... 148 18.4. undo and repeat .......................................................................................... 148 18.5. cut, copy and paste a line .......................................................................... 148 18.6. cut, copy and paste lines ............................................................................ 149 18.7. start and end of line ................................................................................... 149 18.8. join two lines ............................................................................................. 149 18.9. words .......................................................................................................... 150 18.10. save and exit vi ........................................................................................ 150 18.11. searching .................................................................................................. 151 18.12. replace ...................................................................................................... 151 18.13. read files and input .................................................................................. 151 18.14. text buffers ............................................................................................... 152 18.15. multiple files ............................................................................................ 152 18.16. abbreviations ............................................................................................ 152 23.1. Debian User Environment .......................................................................... 206 23.2. Red Hat User Environment ........................................................................ 206 25.1. Unix special files ....................................................................................... 216 25.2. standard Unix file permissions .................................................................. 217 25.3. Unix file permissions position ................................................................... 217 25.4. Octal permissions ....................................................................................... 220 iv Part I. introduction to Linux Chapter 1. Linux history Table of Contents 1.1. Linux history .................................................................................................... 3 This chapter briefly tells the history of Unix and where Linux fits in. If you are eager to start working with Linux without this blah, blah, blah over history, distributions, and licensing then jump straight to Part II - Chapter 6. Working with Directories page 26. 2 Linux