Paul Cobbaut - Linux-training.be

Transcription

Linux FundamentalsPaul Cobbaut

Linux FundamentalsPaul CobbautPublication date 2015-05-24 CESTAbstractThis book is meant to be used in an instructor-led training. For self-study, the intent is to readthis book next to a working Linux computer so you can immediately do every subject, practicingeach command.This book is aimed at novice Linux system administrators (and might be interesting and usefulfor home users that want to know a bit more about their Linux system). However, this bookis not meant as an introduction to Linux desktop applications like text editors, browsers, mailclients, multimedia or office applications.More information and free .pdf available at http://linux-training.be .Feel free to contact the author: Paul Cobbaut: paul.cobbaut@gmail.com, http://www.linkedin.com/in/cobbautContributors to the Linux Training project are: Serge van Ginderachter: serge@ginsys.eu, build scripts and infrastructure setup Ywein Van den Brande: ywein@crealaw.eu, license and legal sections Hendrik De Vloed: hendrik.devloed@ugent.be, buildheader.pl scriptWe'd also like to thank our reviewers: Wouter Verhelst: wo@uter.be, http://grep.be il.com,http://www.linkedin.com/in/ Elie De Brauwer: elie@de-brauwer.be, http://www.de-brauwer.be Christophe Vandeplas: christophe@vandeplas.com, http://christophe.vandeplas.com Bert Desmet: bert@devnox.be, http://blog.bdesmet.be Rich Yonts: richyonts@gmail.com,Copyright 2007-2015 Netsec BVBA, Paul CobbautPermission is granted to copy, distribute and/or modify this document under the terms of theGNU Free Documentation License, Version 1.3 or any later version published by the FreeSoftware Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-CoverTexts. A copy of the license is included in the section entitled 'GNU Free DocumentationLicense'.

Table of ContentsI. introduction to Linux . 11. Linux history . 31.1. 1969 . 41.2. 1980s . 41.3. 1990s . 41.4. 2015 . 52. distributions . 62.1. Red Hat . 72.2. Ubuntu . 72.3. Debian . 72.4. Other . 72.5. Which to choose ? . 83. licensing . 93.1. about software licenses . 103.2. public domain software and freeware . 103.3. Free Software or Open Source Software . 103.4. GNU General Public License . 113.5. using GPLv3 software . 113.6. BSD license . 123.7. other licenses . 123.8. combination of software licenses . 12II. installing Linux . 134. installing Debian 8 . 154.1. Debian . 164.2. Downloading . 164.3. virtualbox networking . 324.4. setting the hostname . 344.5. adding a static ip address . 344.6. Debian package management . 355. installing CentOS 7 . 365.1. download a CentOS 7 image . 375.2. Virtualbox . 395.3. CentOS 7 installing . 445.4. CentOS 7 first logon . 525.5. Virtualbox network interface . 535.6. configuring the network . 545.7. adding one static ip address . 545.8. package management . 555.9. logon from Linux and MacOSX . 565.10. logon from MS Windows . 566. getting Linux at home . 586.1. download a Linux CD image . 596.2. download Virtualbox . 596.3. create a virtual machine . 606.4. attach the CD image . 656.5. install Linux . 68III. first steps on the command line . 697. man pages . 717.1. man command . 727.2. man configfile . 727.3. man daemon . 727.4. man -k (apropos) . 727.5. whatis . 727.6. whereis . 727.7. man sections . 73iii

Linux Fundamentals7.8. man section file . 737.9. man man . 737.10. mandb . 738. working with directories . 748.1. pwd . 758.2. cd . 758.3. absolute and relative paths . 768.4. path completion . 778.5. ls . 778.6. mkdir . 798.7. rmdir . 798.8. practice: working with directories . 818.9. solution: working with directories . 829. working with files . 849.1. all files are case sensitive . 859.2. everything is a file . 859.3. file . 859.4. touch . 869.5. rm . 879.6. cp . 889.7. mv . 899.8. rename . 909.9. practice: working with files . 919.10. solution: working with files . 9210. working with file contents . 9410.1. head . 9510.2. tail . 9510.3. cat . 9610.4. tac . 9710.5. more and less . 9810.6. strings . 9810.7. practice: file contents . 9910.8. solution: file contents . 10011. the Linux file tree . 10111.1. filesystem hierarchy standard . 10211.2. man hier . 10211.3. the root directory / . 10211.4. binary directories . 10311.5. configuration directories . 10511.6. data directories . 10711.7. in memory directories . 10911.8. /usr Unix System Resources . 11411.9. /var variable data . 11611.10. practice: file system tree . 11811.11. solution: file system tree . 120IV. shell expansion . 12212. commands and arguments . 12512.1. arguments . 12612.2. white space removal . 12612.3. single quotes . 12712.4. double quotes . 12712.5. echo and quotes . 12712.6. commands . 12812.7. aliases . 12912.8. displaying shell expansion . 13012.9. practice: commands and arguments . 13112.10. solution: commands and arguments . 13313. control operators . 135iv

Linux Fundamentals13.1. ; semicolon . 13613.2. & ampersand . 13613.3. ? dollar question mark . 13613.4. && double ampersand . 13713.5. double vertical bar . 13713.6. combining && and . 13713.7. # pound sign . 13813.8. \ escaping special characters . 13813.9. practice: control operators . 13913.10. solution: control operators . 14014. shell variables . 14114.1. dollar sign . 14214.2. case sensitive . 14214.3. creating variables . 14214.4. quotes . 14314.5. set . 14314.6. unset . 14314.7. PS1 . 14414.8. PATH . 14514.9. env . 14614.10. export . 14614.11. delineate variables . 14714.12. unbound variables . 14714.13. practice: shell variables . 14814.14. solution: shell variables . 14915. shell embedding and options . 15015.1. shell embedding . 15115.2. shell options . 15215.3. practice: shell embedding . 15315.4. solution: shell embedding . 15416. shell history . 15516.1. repeating the last command . 15616.2. repeating other commands . 15616.3. history . 15616.4. !n . 15616.5. Ctrl-r . 15716.6. HISTSIZE . 15716.7. HISTFILE . 15716.8. HISTFILESIZE . 15716.9. prevent recording a command . 15816.10. (optional)regular expressions . 15816.11. (optional) Korn shell history . 15816.12. practice: shell history . 15916.13. solution: shell history . 16017. file globbing . 16117.1. * asterisk . 16217.2. ? question mark . 16217.3. [] square brackets . 16317.4. a-z and 0-9 ranges . 16417.5. LANG and square brackets . 16417.6. preventing file globbing . 16517.7. practice: shell globbing . 16617.8. solution: shell globbing . 167V. pipes and commands . 16918. I/O redirection . 17118.1. stdin, stdout, and stderr . 17218.2. output redirection . 17318.3. error redirection . 175v

Linux Fundamentals18.4. output redirection and pipes . 17618.5. joining stdout and stderr . 17618.6. input redirection . 17718.7. confusing redirection . 17818.8. quick file clear . 17818.9. practice: input/output redirection . 17918.10. solution: input/output redirection . 18019. filters . 18119.1. cat . 18219.2. tee . 18219.3. grep . 18219.4. cut . 18419.5. tr . 18419.6. wc . 18519.7. sort . 18619.8. uniq . 18719.9. comm . 18819.10. od . 18919.11. sed . 19019.12. pipe examples . 19119.13. practice: filters . 19219.14. solution: filters . 19320. basic Unix tools . 19520.1. find . 19620.2. locate . 19720.3. date . 19720.4. cal . 19820.5. sleep . 19820.6. time . 19920.7. gzip - gunzip .

Linux Fundamentals Paul Cobbaut Publication date 2015-05-24 CEST Abstract This book is meant to be used in an instr