LINUX Rute Users Tutorial and Exposition Version 0.9.1
Total Page:16
File Type:pdf, Size:1020Kb
LINUX Rute Users Tutorial and Exposition Version 0.9.1 For purchasing and support, visit http://www.icon.co.za/˜psheer http://rute.sourceforge.net/ http://rute.sourceforge.net/rute.pdf http://rute.sourceforge.net/rute.ps.gz http://rute.sourceforge.net/rute.dvi.gz http://rute.sourceforge.net/rute-HTML.zip http://rute.sourceforge.net/rute-HTML.tar.gz Copyright °c 2000, 2001 Paul Sheer May 5, 2001 Copying This license dictates the conditions under which you may copy, modify and distribute this work. Email the author for purchasing information. TERMS AND CONDITIONS 1. This work may not be reproduced in hard copy except for personal use. Further, it may not be reproduced in hard copy for training material, nor for commercial gain, nor for public or organisation-wide distribution. Further, it may not be reproduced in hard copy except where the intended reader of the hard copy initiates the process of converting the work to hard copy. 2. The work may not be modified except by a generic format translation utility, as may be appropriate for viewing the work using an alternative electronic media. Such a modified version of the work must clearly credit the author, display this license, and include all copyright notices. Such a modified version of the work must clearly state the means by which it was translated, as well as where an original copy may be obtained. 3. Verbatim copies of the work may be redistributed through any electronic media. Modified versions of the work as per 2. above may be redistributed same, provided that they can reasonably be said to include, albeit in translated form, all the original source files. 4. The work is not distributed to promote any product, computer program or operating system. Even if otherwise cited, all of the opinions expressed in the work are exclusively those of the author. The author withdraws any implication that any statement made within this work can be justified, verified or corroborated. NO WARRANTY 5. THE COPYRIGHT HOLDER(S) PROVIDE NO WARRANTY FOR THE ACCURACY OR COMPLETENESS OF THIS WORK, OR TO THE FUNCTIONALITY OF THE EXAMPLE PROGRAMS OR DATA CONTAINED THEREIN, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 6. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE WORK AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF ii THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS — TRANSLATING INTO OTHER LANGUAGES Several people have requested that they may be permitted to make translations into other languages. If you are interested in translating Rute, please contact the author. You will be sent several chapters in source form for you to translate. These will then be reviewed. Should your translation be acceptable, an agreement well be drawn up which will outline your commitments and remuneration to the project. Note that translation work will be ongoing, since Rute is continually being added to and improved. iii [email protected] +27 21 761-7224 Linux Linux development — cryptography installations — support — training iv Changes 0.9.1 Acknowledgements added. 0.9.0 X configuration completed. Samba Chapter added. Reviewers comments integrated. 0.8.9 Complex routing example. PPP dialup. UUCP chapter added. Apache chapter complete with CGI’s and virtual hosting. 0.8.8 (9 Apr 2001) Apache chapter mostly complete. Advanced scripting chapter added. NFS chapter added. Section on binary, octal and hex added. Lots of corrections, additions and examples. 0.8.7 (14 Mar 2001) Package verification section added. Security chapter ammended. Preinstalled doc chap updated. 0.8.6 (19 Feb 2001) Unix security chapter. Comments assimilated. 0.8.5 /etc/aliases expl added under exim chapter. exim command-line ops. 0.8.4 Lecture Schedule added. More indexing done. Comments assimilated. Thanks to all those that contributed. Please reitereate comments that were not fulfilled. 0.8.3 Ethernet interface aliasing. 0.8.2 2000-10-21 Inetd/xinetd chapter added. FAQ updated. 0.8.1 Init and mgetty chapter added. Faxing sections added. 0.8.0 Kernel Source chapter added 0.7.0 LPI and RHCE summaries added 0.6.0 0.5.0 v 0.4.0 0.3.0 First public release vi Contents 1 Introduction 1 1.1 What this book covers . 1 1.2 Read this next. 1 1.3 What do I need to get started . 1 1.4 More about this book . 2 1.5 I get very frustrated with UNIX documentation that I don’t understand . 2 1.6 LPI and RHCE requirements . 3 1.7 Not RedHat: RedHat-like ............................ 3 2 Computing Sub-basics 5 2.1 Binary, octal, decimal and hexadecimal . 5 2.2 Files . 7 2.3 Commands . 8 2.4 Logging in and changing your password . 8 2.5 Listing and creating files . 9 2.6 Command line editing keys . 9 2.7 Console switching . 10 2.8 Creating files . 11 2.9 Allowable characters for filenames . 11 2.10 Directories . 11 vii CONTENTS CONTENTS 3 PC Hardware 13 3.1 Motherboard . 13 3.2 Master/Slave IDE . 17 3.3 CMOS . 18 4 Basic Commands 19 4.1 The ls command, hidden files, command-line options . 19 4.2 Error messages . 20 4.3 Wildcards, names, extensions and glob expressions . 23 4.4 Usage summaries and the copy command . 27 4.5 Manipulating directories . 28 4.6 Relative vs. absolute pathnames . 29 4.7 System manual pages . 29 4.8 System info pages . 30 4.9 Some basic commands . 31 4.10 Multimedia commands for fun . 34 4.11 Terminating commands . 35 4.12 Compressed files . 35 4.13 Searching for files . 36 4.14 Searching within files . 37 4.15 Copying to MSDOS and Windows formatted floppy disks . 38 4.16 Archives and backups . 39 4.17 The PATH where commands are searched for . 40 5 Regular Expressions 43 5.1 Basic regular expression exposition . 43 5.2 The fgrep command . 45 5.3 Regular expression nf ng notation . 45 viii CONTENTS CONTENTS 5.4 + ? n< n> ( ) | notation . 46 5.5 Regular expression sub-exressions . 46 6 Editing Text Files 47 6.1 vi ......................................... 47 6.2 Syntax highlighting . 51 6.3 Editors . 51 6.3.1 Cooledit . 52 6.3.2 vi and vim ............................... 52 6.3.3 Emacs . 52 6.3.4 Other editors . 53 7 Shell Scripting 55 7.1 Introduction . 55 7.2 Looping: the while and until statements . 56 7.3 Looping: the for statement . 57 7.4 breaking out of loops and continueing . 59 7.5 Looping over glob expressions . 60 7.6 The case statement . 60 7.7 Using functions: the function keyword . 61 7.8 Properly processing command line args: shift .............. 62 7.9 More on command-line arguments: $@ and $0 ............... 64 7.10 Single forward quote notation . 64 7.11 Double quote notation . 64 7.12 Backward quote substitution . 65 8 Streams and sed — the stream editor 67 8.1 Introduction . 67 8.2 Tutorial . 68 ix CONTENTS CONTENTS 8.3 Piping using | notation . 68 8.4 A complex piping example . 69 8.5 Redirecting streams with >& .......................... 69 8.6 Using sed to edit streams . 71 8.7 Regular expression sub-expressions . 71 8.8 Inserting and deleting lines . 73 9 Processes and environment variables 75 9.1 Introduction . 75 9.2 Tutorial . 76 9.2.1 Controlling jobs . 76 9.2.2 killing a process, sending a process a signal . 79 9.2.3 List of comman signals . 80 9.2.4 Niceness of processes, and scheduling priority . 80 9.2.5 Listing process CPU/Memory consumption with top ...... 82 9.2.6 Environment’s of processes . 84 10 Mail 91 10.1 Sending and reading mail . 92 10.2 The SMTP protocol — sending mail raw to port 25 ............. 93 11 User accounts and ownerships 95 11.1 Users and Groups . 95 11.2 File ownerships . 96 11.3 The password file /etc/passwd ....................... 96 11.4 Shadow password file: /etc/shadow .................... 97 11.5 The groups command and /etc/group .................. 98 11.6 Manually creating a user account . 99 11.7 Automatically: useradd and groupadd .................. 100 x CONTENTS CONTENTS 11.8 User logins . 100 12 Using Internet Services 105 12.1 ssh, not telnet or rlogin .......................... 105 12.2 FTP . 106 12.3 finger ...................................... 107 12.4 Sending files by email . 107 13 LINUX resources 109 13.1 FTP sites and the sunsite mirror . 109 13.2 HTTP — web sites . 110 13.3 Mailing lists . 111 13.4 Newsgroups . 112 13.5 RFC’s . 113 14 Permission and Modification Times 115 14.1 Permissions . ..