home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / docs / linux-do / install- / install-.002 < prev    next >
Encoding:
Text File  |  1995-09-10  |  637.8 KB  |  13,246 lines

  1.  
  2.  
  3. Author's Note:
  4.  
  5. This is version 2.2.2 of the book, "Linux Installation and Getting
  6. Started", formatted in plain ASCII for those readers without access
  7. to PostScript printers. This document was generated by a set of tools
  8. from LaTeX source, so there may be a number of formatting problems.
  9. This is not the "official" version of the book! Please see
  10.     sunsite.unc.edu:/pub/Linux/docs/LDP/install-guide
  11. for PostScript, DVI, HTML, and other (nicely formatted) versions.
  12. If you have the ability to print the guide or view it on-line,
  13. I suggest you do so. This ASCII version is meant only for previewing 
  14. purposes.
  15.  
  16. This book may be freely distributed under certain conditions, and
  17. you can order a printed and bound copy from a number of publishers.
  18. The README file at the FTP site given above gives all the details.
  19.  
  20.                     -- M. Welsh
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. Linux Installation and Getting Started
  35. _______________________________________________________________________
  36.                                   Copyright (c) 1992--1994  Matt Welsh
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. Version 2.2.2, 11 February 1995.
  44.  
  45. This  book   is   an  installation   and   new-user  guide   for   the
  46. Linux system,  meant for  UNIX novices  and  gurus alike.    Contained
  47. herein is  information on  how to  obtain Linux,  installation of  the
  48. software, a beginning tutorial for new UNIX users, and an introduction
  49. to system administration.    It is meant  to be  general enough to  be
  50. applicable to any distribution of the Linux software.
  51.  
  52.   This book is freely distributable; you may copy  and redistribute it
  53. under certain conditions.   Please see the copyright and  distribution
  54. statement on page x.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Contents
  65.  
  66.  
  67.  
  68.  
  69. Preface                                                             vi
  70.   Audience  . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
  71.   Organization  . . . . . . . . . . . . . . . . . . . . . . . . . . vii
  72.   Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . vii
  73.   Credits and Legalese  . . . . . . . . . . . . . . . . . . . . . . viii
  74.   Documentation Conventions . . . . . . . . . . . . . . . . . . . . xi
  75. 1 Introduction to Linux                                              1
  76.   1.1 About This Book . . . . . . . . . . . . . . . . . . . . . . .  1
  77.   1.2 A Brief History of Linux  . . . . . . . . . . . . . . . . . .  3
  78.   1.3 System Features . . . . . . . . . . . . . . . . . . . . . . .  5
  79.   1.4 Software Features . . . . . . . . . . . . . . . . . . . . . .  6
  80.     1.4.1 Basic commands and utilities  . . . . . . . . . . . . . .  7
  81.     1.4.2 Text processing and word processing . . . . . . . . . . .  8
  82.     1.4.3 Programming languages and utilities . . . . . . . . . . . 11
  83.     1.4.4 The X Window System . . . . . . . . . . . . . . . . . . . 12
  84.     1.4.5 Networking  . . . . . . . . . . . . . . . . . . . . . . . 14
  85.     1.4.6 Telecommunications and BBS software . . . . . . . . . . . 15
  86.     1.4.7 Interfacing with MS-DOS . . . . . . . . . . . . . . . . . 16
  87.     1.4.8 Other applications  . . . . . . . . . . . . . . . . . . . 16
  88.   1.5 About Linux's Copyright . . . . . . . . . . . . . . . . . . . 18
  89.   1.6 The Design and Philosophy of Linux  . . . . . . . . . . . . . 19
  90.     1.6.1 Hints for UNIX novices  . . . . . . . . . . . . . . . . . 22
  91.     1.6.2 Hints for UNIX gurus  . . . . . . . . . . . . . . . . . . 22
  92.   1.7 Differences Between Linux and Other Operating Systems . . . . 23
  93.     1.7.1 Why use Linux?  . . . . . . . . . . . . . . . . . . . . . 23
  94.     1.7.2 Linux vs.  MS-DOS . . . . . . . . . . . . . . . . . . . . 24
  95.     1.7.3 Linux vs.  The Other Guys . . . . . . . . . . . . . . . . 25
  96.     1.7.4 Other implementations of UNIX . . . . . . . . . . . . . . 25
  97.   1.8 Hardware Requirements . . . . . . . . . . . . . . . . . . . . 27
  98.     1.8.1 Motherboard and CPU requirements  . . . . . . . . . . . . 28
  99.     1.8.2 Memory requirements . . . . . . . . . . . . . . . . . . . 28
  100.     1.8.3 Hard drive controller requirements  . . . . . . . . . . . 29
  101.     1.8.4 Hard drive space requirements . . . . . . . . . . . . . . 29
  102.     1.8.5 Monitor and video adapator requirements . . . . . . . . . 30
  103.     1.8.6 Miscellaneous hardware  . . . . . . . . . . . . . . . . . 30
  104.     1.8.7 Ethernet cards  . . . . . . . . . . . . . . . . . . . . . 31
  105.   1.9 Sources of Linux Information  . . . . . . . . . . . . . . . . 32
  106.     1.9.1 Online documents  . . . . . . . . . . . . . . . . . . . . 32
  107.  
  108.  
  109.                                   i
  110.  
  111.  
  112.     1.9.2 Linux on the World Wide Web . . . . . . . . . . . . . . . 33
  113.     1.9.3 Books and other published works . . . . . . . . . . . . . 33
  114.     1.9.4 USENET newsgroups . . . . . . . . . . . . . . . . . . . . 34
  115.     1.9.5 Internet mailing lists  . . . . . . . . . . . . . . . . . 36
  116.   1.10 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . 37
  117.  
  118. 2 Obtaining and Installing Linux                                    40
  119.   2.1 Distributions of Linux  . . . . . . . . . . . . . . . . . . . 40
  120.     2.1.1 Getting Linux from the Internet . . . . . . . . . . . . . 41
  121.     2.1.2 Getting Linux from other online sources . . . . . . . . . 42
  122.     2.1.3 Getting Linux via mail order  . . . . . . . . . . . . . . 42
  123.     2.1.4 Getting Slackware . . . . . . . . . . . . . . . . . . . . 43
  124.   2.2 Preparing to Install Linux  . . . . . . . . . . . . . . . . . 50
  125.     2.2.1 Installation overview . . . . . . . . . . . . . . . . . . 50
  126.     2.2.2 Repartitioning concepts . . . . . . . . . . . . . . . . . 52
  127.     2.2.3 Linux partition requirements  . . . . . . . . . . . . . . 52
  128.     2.2.4 Repartitioning your drives  . . . . . . . . . . . . . . . 54
  129.   2.3 Installing the Linux software . . . . . . . . . . . . . . . . 56
  130.     2.3.1 Booting Linux . . . . . . . . . . . . . . . . . . . . . . 56
  131.     2.3.2 Drives and partitions under Linux . . . . . . . . . . . . 58
  132.     2.3.3 Creating Linux partitions . . . . . . . . . . . . . . . . 60
  133.     2.3.4 Creating the swap space . . . . . . . . . . . . . . . . . 63
  134.     2.3.5 Creating the filesystems  . . . . . . . . . . . . . . . . 64
  135.     2.3.6 Installing the software . . . . . . . . . . . . . . . . . 65
  136.     2.3.7 Creating the boot floppy or installing LILO . . . . . . . 69
  137.     2.3.8 Additional installation procedures  . . . . . . . . . . . 70
  138.   2.4 Postinstallation procedures . . . . . . . . . . . . . . . . . 70
  139.   2.5 Running Into Trouble  . . . . . . . . . . . . . . . . . . . . 71
  140.     2.5.1 Problems with booting the installation media  . . . . . . 72
  141.     2.5.2 Hardware problems . . . . . . . . . . . . . . . . . . . . 74
  142.     2.5.3 Problems installing the software  . . . . . . . . . . . . 79
  143.     2.5.4 Problems after installing Linux . . . . . . . . . . . . . 81
  144. 3 Linux Tutorial                                                    85
  145.   3.1 Introduction  . . . . . . . . . . . . . . . . . . . . . . . . 85
  146.   3.2 Basic UNIX Concepts . . . . . . . . . . . . . . . . . . . . . 86
  147.     3.2.1 Creating an account . . . . . . . . . . . . . . . . . . . 86
  148.     3.2.2 Logging in  . . . . . . . . . . . . . . . . . . . . . . . 86
  149.     3.2.3 Virtual consoles  . . . . . . . . . . . . . . . . . . . . 87
  150.     3.2.4 Shells and commands . . . . . . . . . . . . . . . . . . . 87
  151.     3.2.5 Logging out . . . . . . . . . . . . . . . . . . . . . . . 89
  152.     3.2.6 Changing your password  . . . . . . . . . . . . . . . . . 89
  153.     3.2.7 Files and directories . . . . . . . . . . . . . . . . . . 89
  154.     3.2.8 The directory tree  . . . . . . . . . . . . . . . . . . . 90
  155.     3.2.9 The current working directory . . . . . . . . . . . . . . 90
  156.     3.2.1 0Referring to home directories  . . . . . . . . . . . . . 92
  157.   3.3 First Steps into UNIX . . . . . . . . . . . . . . . . . . . . 92
  158.     3.3.1 Moving around . . . . . . . . . . . . . . . . . . . . . . 92
  159.     3.3.2 Looking at the contents of directories  . . . . . . . . . 93
  160.     3.3.3 Creating new directories  . . . . . . . . . . . . . . . . 95
  161.     3.3.4 Copying files . . . . . . . . . . . . . . . . . . . . . . 96
  162.  
  163.  
  164.     3.3.5 Moving files  . . . . . . . . . . . . . . . . . . . . . . 96
  165.     3.3.6 Deleting files and directories  . . . . . . . . . . . . . 96
  166.     3.3.7 Looking at files  . . . . . . . . . . . . . . . . . . . . 97
  167.     3.3.8 Getting online help . . . . . . . . . . . . . . . . . . . 97
  168.   3.4 Summary of Basic Commands . . . . . . . . . . . . . . . . . . 98
  169.   3.5 Exploring the File System  . . . . . . . . . . . . . . . . . 100
  170.   3.6 Types of shells  . . . . . . . . . . . . . . . . . . . . . . 105
  171.   3.7 Wildcards  . . . . . . . . . . . . . . . . . . . . . . . . . 106
  172.   3.8 UNIX Plumbing  . . . . . . . . . . . . . . . . . . . . . . . 108
  173.     3.8.1 Standard input and output  . . . . . . . . . . . . . . . 108
  174.     3.8.2 Redirecting input and output . . . . . . . . . . . . . . 109
  175.     3.8.3 Using pipes  . . . . . . . . . . . . . . . . . . . . . . 110
  176.     3.8.4 Non-destructive redirection  . . . . . . . . . . . . . . 112
  177.   3.9 File Permissions . . . . . . . . . . . . . . . . . . . . . . 112
  178.     3.9.1 Concepts of file permissions . . . . . . . . . . . . . . 112
  179.     3.9.2 Interpreting file permissions  . . . . . . . . . . . . . 113
  180.     3.9.3 Dependencies . . . . . . . . . . . . . . . . . . . . . . 114
  181.     3.9.4 Changing permissions . . . . . . . . . . . . . . . . . . 115
  182.   3.10 Managing file links . . . . . . . . . . . . . . . . . . . . 115
  183.     3.10.1 Hard links  . . . . . . . . . . . . . . . . . . . . . . 115
  184.     3.10.2 Symbolic links  . . . . . . . . . . . . . . . . . . . . 117
  185.   3.11 Job Control . . . . . . . . . . . . . . . . . . . . . . . . 117
  186.     3.11.1 Jobs and processes  . . . . . . . . . . . . . . . . . . 117
  187.     3.11.2 Foreground and background . . . . . . . . . . . . . . . 118
  188.     3.11.3 Backgrounding and killing jobs  . . . . . . . . . . . . 119
  189.     3.11.4 Stopping and restarting jobs  . . . . . . . . . . . . . 121
  190.   3.12 Using the vi Editor . . . . . . . . . . . . . . . . . . . . 123
  191.     3.12.1 Concepts  . . . . . . . . . . . . . . . . . . . . . . . 124
  192.     3.12.2 Starting vi . . . . . . . . . . . . . . . . . . . . . . 124
  193.     3.12.3 Inserting text  . . . . . . . . . . . . . . . . . . . . 125
  194.     3.12.4 Deleting text . . . . . . . . . . . . . . . . . . . . . 126
  195.     3.12.5 Changing text . . . . . . . . . . . . . . . . . . . . . 127
  196.     3.12.6 Moving commands . . . . . . . . . . . . . . . . . . . . 128
  197.     3.12.7 Saving files and quitting vi  . . . . . . . . . . . . . 128
  198.     3.12.8 Editing another file  . . . . . . . . . . . . . . . . . 129
  199.     3.12.9 Including other files . . . . . . . . . . . . . . . . . 129
  200.     3.12.10 Running shell commands . . . . . . . . . . . . . . . . 130
  201.     3.12.11 Getting help . . . . . . . . . . . . . . . . . . . . . 130
  202.   3.13Customizing your Environment . . . . . . . . . . . . . . . . 130
  203.     3.13.1 Shell scripts . . . . . . . . . . . . . . . . . . . . . 131
  204.     3.13.2 Shell variables and the environment . . . . . . . . . . 132
  205.     3.13.3 Shell initialization scripts  . . . . . . . . . . . . . 135
  206.   3.14 So You Want to Strike Out on Your Own?  . . . . . . . . . . 135
  207.  
  208. 4 System Administration                                            137
  209.   4.1  About Root, Hats, and the Feeling of Power  . . . . . . . . 137
  210.     4.1.1 The root account . . . . . . . . . . . . . . . . . . . . 137
  211.     4.1.2 Abusing the system . . . . . . . . . . . . . . . . . . . 139
  212.     4.1.3 Dealing with users . . . . . . . . . . . . . . . . . . . 139
  213.     4.1.4 Setting the rules  . . . . . . . . . . . . . . . . . . . 140
  214.     4.1.5 What it all means  . . . . . . . . . . . . . . . . . . . 140
  215.  
  216.  
  217.   4.2  Booting the System  . . . . . . . . . . . . . . . . . . . . 141
  218.     4.2.1 Using a boot floppy  . . . . . . . . . . . . . . . . . . 141
  219.     4.2.2 Using LILO . . . . . . . . . . . . . . . . . . . . . . . 142
  220.   4.3 Shutting Down  . . . . . . . . . . . . . . . . . . . . . . . 143
  221.   4.4 Managing Users . . . . . . . . . . . . . . . . . . . . . . . 144
  222.     4.4.1 User management concepts . . . . . . . . . . . . . . . . 144
  223.     4.4.2 Adding users . . . . . . . . . . . . . . . . . . . . . . 146
  224.     4.4.3 Deleting users . . . . . . . . . . . . . . . . . . . . . 146
  225.     4.4.4 Setting user attributes  . . . . . . . . . . . . . . . . 146
  226.     4.4.5 Groups . . . . . . . . . . . . . . . . . . . . . . . . . 147
  227.   4.5 Archiving and Compressing Files  . . . . . . . . . . . . . . 147
  228.     4.5.1 Using tar  . . . . . . . . . . . . . . . . . . . . . . . 148
  229.     4.5.2 gzip and compress  . . . . . . . . . . . . . . . . . . . 149
  230.     4.5.3 Putting them together  . . . . . . . . . . . . . . . . . 149
  231.   4.6 Using Floppies and Making Backups  . . . . . . . . . . . . . 151
  232.     4.6.1 Using floppies for backups . . . . . . . . . . . . . . . 151
  233.     4.6.2 Using floppies as filesystems  . . . . . . . . . . . . . 151
  234.   4.7 Upgrading and Installing New Software  . . . . . . . . . . . 152
  235.     4.7.1 Upgrading the kernel . . . . . . . . . . . . . . . . . . 153
  236.     4.7.2 Upgrading the libraries  . . . . . . . . . . . . . . . . 154
  237.     4.7.3 Upgrading gcc  . . . . . . . . . . . . . . . . . . . . . 155
  238.     4.7.4 Upgrading other software . . . . . . . . . . . . . . . . 156
  239.   4.8 Managing Filesystems . . . . . . . . . . . . . . . . . . . . 156
  240.     4.8.1 Mounting filesystems . . . . . . . . . . . . . . . . . . 156
  241.     4.8.2 Checking filesystems . . . . . . . . . . . . . . . . . . 158
  242.   4.9 Using a swap file  . . . . . . . . . . . . . . . . . . . . . 159
  243.   4.10 Miscellaneous Tasks . . . . . . . . . . . . . . . . . . . . 160
  244.     4.10.1 System startup files  . . . . . . . . . . . . . . . . . 160
  245.     4.10.2 Setting the hostname  . . . . . . . . . . . . . . . . . 161
  246.   4.11 What To Do In An Emergency  . . . . . . . . . . . . . . . . 162
  247.     4.11.1 Recovering using a maintenance diskette . . . . . . . . 162
  248.     4.11.2 Fixing the root password  . . . . . . . . . . . . . . . 163
  249.     4.11.3 Fixing trashed filesystems  . . . . . . . . . . . . . . 163
  250.     4.11.4 Recovering lost files . . . . . . . . . . . . . . . . . 164
  251.     4.11.5 Fixing trashed libraries  . . . . . . . . . . . . . . . 164
  252.  
  253. 5 Advanced Features                                                165
  254.   5.1 The X Window System  . . . . . . . . . . . . . . . . . . . . 165
  255.     5.1.1 Hardware requirements  . . . . . . . . . . . . . . . . . 166
  256.     5.1.2 Installing XFree86 . . . . . . . . . . . . . . . . . . . 168
  257.     5.1.3 Configuring XFree86  . . . . . . . . . . . . . . . . . . 170
  258.     5.1.4 Filling in video card information  . . . . . . . . . . . 178
  259.     5.1.5 Running XFree86  . . . . . . . . . . . . . . . . . . . . 182
  260.     5.1.6 Running into trouble . . . . . . . . . . . . . . . . . . 183
  261.   5.2 Accessing MS-DOS Files . . . . . . . . . . . . . . . . . . . 184
  262.   5.3 Networking with TCP/IP . . . . . . . . . . . . . . . . . . . 185
  263.     5.3.1 Hardware Requirements  . . . . . . . . . . . . . . . . . 186
  264.     5.3.2 Configuring TCP/IP on your system  . . . . . . . . . . . 186
  265.     5.3.3 SLIP Configuration . . . . . . . . . . . . . . . . . . . 194
  266.     5.3.4 Using dip  . . . . . . . . . . . . . . . . . . . . . . . 197
  267.   5.4 Networking with UUCP . . . . . . . . . . . . . . . . . . . . 199
  268.                                                                      v
  269. _______________________________________________________________________
  270.  
  271.   5.5 Electronic Mail  . . . . . . . . . . . . . . . . . . . . . . 200
  272.   5.6 News and USENET  . . . . . . . . . . . . . . . . . . . . . . 200
  273.  
  274. A Sources of Linux Information                                     203
  275.   A.1 Online Documents . . . . . . . . . . . . . . . . . . . . . . 203
  276.   A.2 Linux Documentation Project Manuals  . . . . . . . . . . . . 205
  277.   A.3 Books and Other Published Works  . . . . . . . . . . . . . . 206
  278.     A.3.1 Using UNIX . . . . . . . . . . . . . . . . . . . . . . . 207
  279.     A.3.2 Systems Administration . . . . . . . . . . . . . . . . . 207
  280.     A.3.3 The X Window System  . . . . . . . . . . . . . . . . . . 208
  281.     A.3.4 Programming  . . . . . . . . . . . . . . . . . . . . . . 208
  282.     A.3.5 Kernel Hacking . . . . . . . . . . . . . . . . . . . . . 209
  283. B Linux Vendor List                                                211
  284.  
  285. C FTP Tutorial and Site List                                       214
  286.   C.1 Starting ftp . . . . . . . . . . . . . . . . . . . . . . . . 214
  287.   C.2 Logging In . . . . . . . . . . . . . . . . . . . . . . . . . 215
  288.   C.3 Poking Around  . . . . . . . . . . . . . . . . . . . . . . . 215
  289.   C.4 Downloading files  . . . . . . . . . . . . . . . . . . . . . 217
  290.   C.5 Quitting FTP   . . . . . . . . . . . . . . . . . . . . . . . 219
  291.   C.6 Using ftpmail  . . . . . . . . . . . . . . . . . . . . . . . 220
  292.   C.7 Linux FTP Site List  . . . . . . . . . . . . . . . . . . . . 220
  293. D Linux BBS List                                                   222
  294.   D.1 United States  . . . . . . . . . . . . . . . . . . . . . . . 222
  295.   D.2 Outside of the United States . . . . . . . . . . . . . . . . 224
  296.  
  297. E The GNU General Public License                                   227
  298.   E.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . 227
  299.   E.2 Terms  and  Conditions  for  Copying,   Distribution,  and
  300.     Modification  . . . . . . . . . . . . . . . . . . . . . . . .  228
  301.   E.3 Appendix:  How to Apply These Terms to Your New Programs . . 233
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311. Preface
  312.  
  313.  
  314.  
  315. ``You are in a maze of twisty little passages, all alike.''
  316.   Before you looms  one of the  most complex and utterly  intimidating
  317. systems ever written.   Linux,  the free UNIX  clone for the  personal
  318. computer, produced by a mishmash team of UNIX gurus, hackers,  and the
  319. occasional loon.   The system itself  reflects this complex  heritage,
  320. and although the development of Linux may appear to be  a disorganized
  321. volunteer effort, the system  is powerful, fast,  and free.   It is  a
  322. true 32-bit operating system solution.
  323.   My  own experiences  with  Linux began  several  years ago,  when  I
  324. sat down  to  figure out  how  to  install the  only  ``distribution''
  325. available at the time---a couple  of diskettes made available by  H.J.
  326. Lu.   I  downloaded a  slew  of files  and read  pages  upon pages  of
  327. loosely-organized installation notes.   Somehow, I managed to  install
  328. this basic  system and  get everything  working together.    This  was
  329. long before you could buy the Linux software on CD-ROM  from worldwide
  330. distributors; before, in fact, Linux even knew how to  access a CD-ROM
  331. drive.   This  was before  XFree86,  before Emacs,  before  commercial
  332. software support,  and before  Linux became  a true  rival to  MS-DOS,
  333. Microsoft Windows, and OS/2 in the personal computer market.
  334.   You hold in  your very hands the map  and guidebook to the  world of
  335. Linux.  It is my hope that this book will help you to get rolling with
  336. what I consider to be the fastest, most powerful  operating system for
  337. the personal computer.    Setting up your  own Linux  system can be  a
  338. great deal of fun---so grab a cup of coffee, sit back, and read on.
  339.   Grab a cup for  me, too, while you're at  it.  I've been  up hacking
  340. Linux for days.
  341.  
  342.  
  343. Audience
  344.  
  345. This book is for any personal  computer user who wants to  install and
  346. use Linux on their system.   We assume  that you have basic  knowledge
  347. about personal  computers and  operating systems  such  as MS-DOS.  No
  348. previous knowledge about Linux or UNIX is assumed.
  349.   Despite this,  we strongly suggest that  UNIX novices invest in  one
  350. of the many good UNIX books out there.  Several of them  are listed in
  351. Appendix A.
  352.  
  353.  
  354.  
  355.  
  356.                                   vi
  357.                                                                    vii
  358. _______________________________________________________________________
  359.  
  360. Organization
  361.  
  362. This book contains the following chapters.
  363.   Chapter 1,  Introduction to Linux,  gives a general introduction  to
  364. what Linux is, what it can do for you, and what is required  to run it
  365. on your system.  It  also provides helpful hints for getting  help and
  366. reducing overall stress.
  367.   Chapter 2,  Obtaining and Installing Linux,  explains how to  obtain
  368. the Linux software, as well as how to install it---from repartitioning
  369. your drive,  creating filesystems,  and  loading the  software on  the
  370. system.    It  contains  instructions  meant to  be  general  for  any
  371. distribution of Linux,  and relies on  the documentation provided  for
  372. your particular release to fill in any gaps.
  373.   Chapter 3, Linux Tutorial,  is a complete introduction to  using the
  374. Linux system for UNIX novices.  If you have  previous UNIX experience,
  375. most of this material should be familiar.
  376.   Chapter 4, System  Administration, introduces many of  the important
  377. concepts of system  administration under  Linux.   This  will also  be
  378. of interest to UNIX system  administrators who want to know  about the
  379. Linux-specific issues of running a system.
  380.   Chapter 5, Advanced Features,  introduces the reader to a  number of
  381. advanced features supported by Linux, such as the X  Window System and
  382. TCP/IP networking.   A  complete guide to  configuring XFree86-3.1  is
  383. included.
  384.   Appendix A,  Sources of  Linux Information,  is a  listing of  other
  385. sources of  information  about Linux,  including  newsgroups,  mailing
  386. lists, online documents, and books.
  387.   Appendix B,  Linux Vendor List,  provides a  short list of  software
  388. vendors offering Linux software and services.
  389.   Appendix  C,  FTP  Tutorial  and  Site  List,   is  a  tutorial  for
  390. downloading files  from  the Internet  with  FTP. This  appendix  also
  391. includes a listing of FTP archive sites which carry Linux software.
  392.   Appendix D, Linux BBS  List, is a listing of bulletin  board systems
  393. worldwide which carry Linux software.  Because most Linux users are do
  394. not have access to the Internet,  it is important that  information on
  395. BBS systems becomes available.
  396.   Appendix E,  The  GNU General  Public License,  contains  a copy  of
  397. the GNU GPL, the license  agreement under which Linux is  distributed.
  398. It is  very  important  that  Linux users  understand  the  GPL;  many
  399. disagreements over the  terms of the  GPL have  been raised in  recent
  400. months.
  401.  
  402.  
  403. Acknowledgments
  404.  
  405. This book has been long in the making, and many people are responsible
  406. for the  outcome.     In  particular,  I would  like  to  thank  Larry
  407. Greenfield and  Karl Fogel  for their  work on  the  first version  of
  408. Chapter 3, and to Lars  Wirzenius for his work  on Chapter 4.   Thanks
  409. to Michael K. Johnson  for his assistance with  the LDP and the  LaTeX
  410.                                                                   viii
  411. _______________________________________________________________________
  412.  
  413. conventions used in this manual, and to Ed Chi, who sent  me a printed
  414. copy of the book for edition.
  415.   Thanks to Melinda A. McBride at SSC, Inc., who  did an excellent job
  416. completing the index for Chapters 3, 4,  and 5.  I would also  like to
  417. thank Andy Oram, Lar Kaufman, and Bill Hahn at O'Reilly and Associates
  418. for their assistance with the Linux Documentation Project.
  419.   Thanks to  Linux Systems Labs,  Morse Telecommunications,  Yggdrasil
  420. Computing, and  others for their  support of  the Linux  Documentation
  421. Project through sales of this book and other works.
  422.   Much  thanks to  the many  activists,  including (in  no  particular
  423. order) Linus Torvalds, Donald Becker,  Alan Cox, Remy Card,  Ted T'so,
  424. H.J. Lu, Ross Biro, Drew Eckhardt,  Ed Carp, Eric Youngdale,  Fred van
  425. Kempen, Steven Tweedie, and  a score of  others, for devoting so  much
  426. time and energy to  this project, and  without whom there wouldn't  be
  427. anything to write a book about.
  428.   Special thanks to the myriad of readers who  have sent their helpful
  429. comments and corrections.  There are  far too many to list here.   Who
  430. needs a spell checker, when you have an audience?
  431.  
  432.                                                             Matt Welsh
  433.                                                        13 January 1994
  434.  
  435.  
  436. Credits and Legalese
  437.  
  438. The  Linux  Documentation  Project  is   a  loose  team  of   writers,
  439. proofreaders, and editors who are working on a set of definitive Linux
  440. manuals.  The overall coordinator of the project is Matt  Welsh, aided
  441. by Lars Wirzenius and Michael K. Johnson.
  442.   This  manual is  but  one in  a  set  of several  being  distributed
  443. by the Linux  Documentation Project, including  a Linux User's  Guide,
  444. System Administrator's  Guide,  and  Kernel  Hacker's Guide.     These
  445. manuals are  all  available  in  LaTeX source  format  and  Postscript
  446. output for  anonymous  FTP  from  sunsite.unc.edu,  in  the  directory
  447. /pub/Linux/docs/LDP.
  448.   We encourage anyone with  a penchant for writing or editing  to join
  449. us in improving  Linux documentation.    If you  have Internet  e-mail
  450. access, you can  join the DOC channel  of the Linux-Activists  mailing
  451. list by sending mail to
  452.  
  453.     linux-activists-request@niksula.hut.fi
  454.  
  455. with the line
  456.  
  457.     X-Mn-Admin:  join DOC
  458.  
  459. as the first line of the message body.
  460.   Feel free to  get in touch with  the author and coordinator of  this
  461. manual if you have questions, postcards, money, or ideas.   Matt Welsh
  462. can be reached via Internet e-mail at mdw@sunsite.unc.edu, and in real
  463.                                                                     ix
  464. _______________________________________________________________________
  465.  
  466. life at
  467.  
  468.     205 Gray Street
  469.     Wilson, N.C. 27896
  470.     U.S.A.
  471.                                                                      x
  472. _______________________________________________________________________
  473.  
  474. UNIX is a trademark of X/Open.
  475. Linux is not a trademark, and has no connection to UNIXTM or X/Open.
  476. The X Window System is  a trademark of the Massachusetts  Institute of
  477. Technology.
  478. MS-DOS and Microsoft Windows are trademarks of Microsoft, Inc.
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493. Copyright cO1992--1994  Matt Welsh
  494. 205 Gray Street NE, Wilson NC, 27893 USA
  495. mdw@sunsite.unc.edu
  496.  
  497. Linux  Installation  and  Getting   Started  may  be  reproduced   and
  498. distributed, in whole or in part, subject to the following conditions:
  499.  
  500. 0.  The copyright  notice above  and this  permission  notice must  be
  501.     preserved complete on all complete or partial copies.
  502.  
  503. 1.  Any translation  or  derivative  work of  Linux  Installation  and
  504.     Getting Started must be approved  by the author in  writing before
  505.     distribution.
  506.  
  507. 2.  If you distribute Linux Installation and Getting Started  in part,
  508.     instructions for  obtaining the  complete version  of this  manual
  509.     must be included,  and a  means for  obtaining a complete  version
  510.     provided.
  511.  
  512. 3.  Small portions may be  reproduced as illustrations for reviews  or
  513.     quotes in other  works without  this permission  notice if  proper
  514.     citation is given.
  515.  
  516. 4.  The GNU General Public License referenced below may  be reproduced
  517.     under the conditions given within it.
  518.  
  519. 5.  Several  sections  of  this  document  are  held   under  separate
  520.     copyright.    When  these  sections are  covered  by  a  different
  521.     copyright, the separate  copyright is  noted.   If you  distribute
  522.     Linux Installation  and Getting  Started in  part,  and that  part
  523.     is, in  whole,  covered under  a  separate, noted  copyright,  the
  524.     conditions of that copyright apply.
  525.                                                                     xi
  526. _______________________________________________________________________
  527.  
  528.   Exceptions   to   these  rules   may   be   granted   for   academic
  529. purposes:   Write  to Matt  Welsh,  at  the above  address,  or  email
  530. mdw@sunsite.unc.edu, and ask.  These restrictions are here  to protect
  531. us as authors, not to restrict you as educators and learners.
  532.   The author encourages  distributors of Linux software in  any medium
  533. to use the  book as an  installation and new  user guide.   Given  the
  534. copyright above, you are free  to print and distribute copies  of this
  535. book with your software.  You may either distribute this  book free of
  536. charge, or for profit.  If  doing so, you may wish to include  a short
  537. ``installation supplement'' for your release.
  538.   The  author  would  like  to  know  of  any  plans  to  publish  and
  539. distribute this book commercially.   In this  way, we can ensure  that
  540. you are kept up-to-date with new revisions.  And, should a new version
  541. be right around the corner,  you might wish to delay  your publication
  542. of the book until it is available.
  543.   If  you   are  distributing  this   book  commercially,   donations,
  544. royalties,  and/or printed  copies  are  greatly  appreciated  by  the
  545. author.  Contributing in this way shows your support for free software
  546. and the Linux Documentation Project.
  547.  
  548. All source code in  Linux Installation and  Getting Started is  placed
  549. under the GNU General Public  License.  See  Appendix E for a copy  of
  550. the GNU ``GPL.''
  551.  
  552.  
  553. Documentation Conventions
  554.  
  555. These conventions should be obvious,  but we'll include them  here for
  556. the pedantic.
  557.  
  558. Bold       Used  to mark  new concepts,  WARNINGS, and  keywords in  a
  559.            language.
  560.  
  561. italics    Used for  emphasis in text, and occasionally for  quotes or
  562.            introductions at the beginning of a section.   Also used to
  563.            indicate commands for the user to  type when showing screen
  564.            interaction (see below).
  565. <slanted>  Used  to mark  meta-variables in  the text,  especially  in
  566.            representations of the command line.  For example,
  567.  
  568.  
  569.                ls -l <foo>
  570.  
  571.            where  <foo>  would  ``stand  for''  a  filename,  such  as
  572.            /bin/cp.
  573.  
  574. Typewriter Used to represent screen interaction, as in
  575.  
  576.  
  577.                $ ls --l /bin/cp
  578.                -rwxr-xr-
  579.                                                                    xii
  580. _______________________________________________________________________
  581.  
  582.                x  1 root    wheel    12104 Sep 25 15:53 /bin/cp
  583.  
  584.  
  585.            Also used for code examples, whether it  is C code, a shell
  586.            script,  or something else,  and to display general  files,
  587.            such as configuration files.   When necessary for clarity's
  588.            sake,  these examples or figures  will be enclosed in  thin
  589.            boxes.
  590. [Key]      Represents a key  to press.  You will often see it  in this
  591.            form:
  592.  
  593.  
  594.                Press [return] to continue.
  595.  
  596. !          A  diamond in the  margin, like  a black  diamond on a  ski
  597.            hill,  marks ``danger''  or ``caution.''   Read  paragraphs
  598.            marked this way carefully.
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607. Chapter 1
  608.  
  609.  
  610.  
  611.  
  612. Introduction to Linux
  613.  
  614.  
  615.  
  616. Linux is  quite  possibly  the  most  important  achievement  of  free
  617. software since the original Space War,  or, more recently, Emacs.   It
  618. has developed into the operating system for businesses, education, and
  619. personal productivity.  Linux is  no longer just for UNIX  wizards who
  620. sit for hours in front of the glowing console (although  we assure you
  621. that quite a number of users fall into this category).  This book will
  622. help you get the most out of it.
  623.   Linux  (pronounced with  a short  i,  as in  LIH-nucks)  is a  clone
  624. of the  UNIX operating  system  that runs  on  Intel 80386  and  80486
  625. computers.    It  supports a  wide  range  of software,  from  TeX  to
  626. X Windows to the GNU C/C++ compiler to TCP/IP.  It's a versatile, bona
  627. fide implementation of UNIX,  freely distributed by  the terms of  the
  628. GNU General Public License (see Appendix E).
  629.   Linux can  turn any  386 or  486 PC  into a  workstation.   It  will
  630. give you the full power  of UNIX at your  fingertips.  Businesses  are
  631. installing Linux on entire networks  of machines, using the  operating
  632. system to manage  financial and hospital  records, a distributed  user
  633. computing environment,  telecommunications, and  more.    Universities
  634. worldwide are using  Linux for teaching  courses on operating  systems
  635. programming and  design.     And,  of  course,  computing  enthusiasts
  636. everywhere are using Linux at home, for programming, productivity, and
  637. all-around hacking.
  638.   What makes Linux  so different is that  it is a free  implementation
  639. of UNIX.  It was  and still  is developed  by a  group of  volunteers,
  640. primarily on the Internet, exchanging code, reporting bugs, and fixing
  641. problems in an open-ended environment.   Anyone is welcome to  join in
  642. the Linux development effort:  all  it takes is interest in  hacking a
  643. free UNIX clone and some kind of programming know-how.   The book that
  644. you hold in your hands is your tour guide.
  645.  
  646. 1.1 About This Book
  647.  
  648. This book  is  an installation  and  entry-level  guide to  the  Linux
  649. system.   The purpose  is to  get new users  up and  running with  the
  650. system by consolodating  as much important  material as possible  into
  651.  
  652.  
  653.                                   1
  654. 1.1.   About This Book                                               2
  655. _______________________________________________________________________
  656.  
  657. one book.  Instead of covering many of the volatile technical details,
  658. those things which tend to change with rapid development,  we give you
  659. enough background to find out more on your own.
  660.   Linux is  not difficult to install  and use.   However, as with  any
  661. implementation of UNIX, there  is often some  black magic involved  to
  662. get everything working correctly.  We hope that this book will get you
  663. on the Linux tourbus and show you how groovy this operating system can
  664. be.
  665.   In this book, we cover the following topics.
  666.  
  667.  o  What is Linux?  The design and philosophy of this unique operating
  668.     system, and what it can do for you.
  669.  
  670.  o  All of  the details  of what  is needed  to run  Linux,  including
  671.     suggestions on what kind of hardware configuration  is recommended
  672.     for a complete system.
  673.  
  674.  o  How to obtain  and install Linux.    There are many  distributions
  675.     of  the  Linux  software.     We  present  a   general  discussion
  676.     of  Linux  software  distributions,   how  to  obtain  them,   and
  677.     generic instructions for installing the software (which  should be
  678.     applicable to any distribution).
  679.  
  680.     This edition also contains specific instructions for the Slackware
  681.     distribution of Linux.
  682.  
  683.  o  A brief introductory UNIX tutorial, for those users who have never
  684.     had experience with UNIX before.  This tutorial should, hopefully,
  685.     provide enough material for complete novices to have  enough basic
  686.     know-how to find their way around the system.
  687.  
  688.  o  An introduction to systems administration with Linux.  This covers
  689.     the most important tasks  that new Linux administrators will  need
  690.     to be familiar with, such as creating users, managing filesystems,
  691.     and so forth.
  692.  
  693.  o  Information on configuring  more advanced aspects  of Linux,  such
  694.     as the X Window System,  networking with TCP/IP and SLIP,  and the
  695.     setup of electronic mail and news systems.
  696.  
  697.   This book is for  the personal computer user wishing to  get started
  698. with Linux.  We don't  assume previous UNIX experience, but  do expect
  699. novices to  refer  to  other materials  along  the  way.    For  those
  700. unfamiliar with UNIX, a list of useful sources of information is given
  701. in Appendix A.  In general,  this book is meant to be read  along with
  702. another book on basic UNIX concepts.
  703. 1.2.   A Brief History of Linux                                      3
  704. _______________________________________________________________________
  705.  
  706. 1.2 A Brief History of Linux
  707.  
  708. UNIX is one of the most popular operating systems worldwide because of
  709. its large support base and distribution.  It was  originally developed
  710. as a  multitasking  system for  minicomputers  and mainframes  in  the
  711. mid-1970's, but has since grown to become one of the  most widely used
  712. operating systems anywhere, despite its sometimes  confusing interface
  713. and lack of central standardization.
  714.   The real  reason  for UNIX's  popularity?   Many  hackers feel  that
  715. UNIX is the Right Thing---the One  True Operating System.  Hence,  the
  716. development of Linux by an expanding group of UNIX hackers who want to
  717. get their hands dirty with their own system.
  718.   Versions  of UNIX  exist for  many  systems---ranging from  personal
  719. computers to supercomputers such as the  Cray Y-MP.  Most  versions of
  720. UNIX for personal computers  are quite expensive  and cumbersome.   At
  721. the time of this writing, a one-machine version of AT&T's System V for
  722. the 386 runs at about US$1500.
  723.   Linux is a freely distributable version of  UNIX developed primarily
  724. by Linus Torvalds (1) at the University of Helsinki in Finland.  Linux
  725. was developed  with the  help  of many  UNIX programmers  and  wizards
  726. across the Internet, allowing anyone with enough know-how and gumption
  727. the ability  to develop  and  change the  system.    The Linux  kernel
  728. uses no code from  AT&T or any other  proprietary source, and much  of
  729. the software available for  Linux is developed  by the GNU project  at
  730. the Free Software  Foundation in Cambridge,  Massachusetts.   However,
  731. programmers all over the world have contributed to the growing pool of
  732. Linux software.
  733.   Linux  was  originally  developed  as  a  hobby   project  by  Linus
  734. Torvalds.   It was inspired  by Minix, a  small UNIX system  developed
  735. by Andy Tanenbaum,  and   the first  discussions about  Linux were  on
  736. the USENET newsgroup comp.os.minix.  These discussions  were concerned
  737. mostly with the development of a small, academic UNIX system for Minix
  738. users who wanted more.
  739.   The very  early development  of Linux  was mostly  dealing with  the
  740. task-switching features  of the  80386 protected-mode  interface,  all
  741. written in assembly code.  Linus writes,
  742.  
  743.      ``After that it  was plain sailing:  hairy coding still,  but
  744.     I had some devices, and debugging was easier.  I started using
  745.     C at  this stage,  and it  certainly  speeds up  developement.
  746.     This is also when I start to get serious about my megalomaniac
  747.     ideas to make `a better Minix  than Minix'.  I was  hoping I'd
  748.     be able to recompile gcc under Linux some day...
  749.      ``Two months for  basic setup, but then only slightly  longer
  750.     until I had  a disk-driver (seriously  buggy, but it  happened
  751.     to work  on my  machine) and  a small  filesystem.   That  was
  752.     about when I made 0.01 available [around late August of 1991]:
  753.  
  754. ----------------------------
  755.  1. torvalds@kruuna.helsinki.fi.
  756. 1.2.   A Brief History of Linux                                      4
  757. _______________________________________________________________________
  758.  
  759.     it wasn't pretty,  it had  no floppy driver,  and it  couldn't
  760.     do much anything.   I don't  think anybody ever compiled  that
  761.     version.  But by  then I was hooked,  and didn't want to  stop
  762.     until I could chuck out Minix.''
  763.  
  764.   No  announcement  was  ever made  for  Linux  version  0.01.     The
  765. 0.01 sources weren't even  executable:  they  contained only the  bare
  766. rudiments of the kernel source, and  assumed that you had access  to a
  767. Minix machine to compile and play with them.
  768.   On 5  October 1991, Linus  announced the first ``official''  version
  769. of Linux, version 0.02.   At  this point, Linus  was able to run  bash
  770. (the GNU Bourne  Again Shell) and  gcc (the GNU  C compiler), but  not
  771. very much else was working.   Again,  this was intended as a  hacker's
  772. system.  The primary focus was kernel development---none of the issues
  773. of user support, documentation, distribution, and so on had  even been
  774. addressed.   Today, the  Linux community  still seems  to treat  these
  775. ergonomic issues  as secondary  to  the ``real  programming''---kernel
  776. development.
  777.   Linus wrote in comp.os.minix,
  778.  
  779.      ``Do you pine for  the nice days of Minix-1.1, when  men were
  780.     men and wrote  their own device  drivers?   Are you without  a
  781.     nice project and just dying to cut your teeth on a  OS you can
  782.     try to modify for your needs?  Are you finding  it frustrating
  783.     when everything works on Minix?  No more all-nighters to get a
  784.     nifty program working?  Then this post might be just for you.
  785.      ``As  I  mentioned  a  month  ago,  I'm  working  on  a  free
  786.     version of a  Minix-lookalike for  AT-386 computers.   It  has
  787.     finally reached the stage where  it's even usable (though  may
  788.     not be  depending on  what  you want),  and  I am  willing  to
  789.     put out  the sources  for  wider distribution.    It  is  just
  790.     version 0.02...but I've successfully  run bash, gcc, gnu-make,
  791.     gnu-sed, compress, etc.  under it.''
  792.  
  793.   After version 0.03, Linus  bumped the version number up to  0.10, as
  794. more people started  to work  on the  system.   After several  further
  795. revisions, Linus increased the version number to 0.95, to  reflect his
  796. expectation that  the system  was ready  for  an ``official''  release
  797. very soon.   (Generally, software is  not assigned the version  number
  798. 1.0 until it  is theoretically  complete or  bug-free.)   This was  in
  799. March of 1992.   Almost a year and a  half later, in late  December of
  800. 1993, the Linux kernel was still at version 0.99.pl14---asymptotically
  801. approaching 1.0.  As of  the time of this writing, the  current kernel
  802. version is 1.1 patchlevel 52, and 1.2 is right around the corner.
  803.   Today,  Linux  is   a  complete  UNIX  clone,  capable   of  running
  804. X Windows,  TCP/IP, Emacs,  UUCP,  mail and  news software,  you  name
  805. it.  Almost all of  the major free software packages have  been ported
  806. to Linux, and commercial  software is becoming  available.  Much  more
  807. hardware is supported than in original  versions of the kernel.   Many
  808. people have  executed  benchmarks on  80486  Linux systems  and  found
  809. 1.3.   System Features                                               5
  810. _______________________________________________________________________
  811.  
  812. them comparable with mid-range workstations from Sun  Microsystems and
  813. Digital Equipment Corporation.  Who would have ever guessed  that this
  814. ``little'' UNIX clone would have grown up to take on  the entire world
  815. of personal computing?
  816.  
  817.  
  818. 1.3 System Features
  819.  
  820. Linux supports most of the features found in other  implementations of
  821. UNIX, plus quite a few that aren't found elsewhere.  This section is a
  822. nickel tour of the Linux kernel features.
  823.   Linux is a  complete multitasking, multiuser operating  system (just
  824. like all  other versions  of UNIX).  This means  that  many users  can
  825. be logged into  the same  machine at once,  running multiple  programs
  826. simultaneously.
  827.   The  Linux  system  is mostly  compatible  with  a  number  of  UNIX
  828. standards (inasmuch  as  UNIX  has  standards) on  the  source  level,
  829. including IEEE  POSIX.1,  System V,  and  BSD features.        It  was
  830. developed with source portability  in mind:   therefore, you are  most
  831. likely to find commonly-used  features in the  Linux system which  are
  832. shared across multiple  implementations.   A great  deal of free  UNIX
  833. software available on  the Internet  and elsewhere  compiles on  Linux
  834. out of the box.   In addition, all  source code for the Linux  system,
  835. including the kernel,  device drivers, libraries,  user programs,  and
  836. development tools, is freely distributable.
  837.   Other  specific  internal  features  of  Linux   include  POSIX  job
  838. control (used by shells  such as csh  and bash), pseudoterminals  (pty
  839. devices), and  support  for  national or  customized  keyboards  using
  840. dynamically-loadable keyboard drivers.    Linux also supports  virtual
  841. consoles, which allow  you to switch  between multiple login  sessions
  842. from the system console in text mode.  Users of the ``screen'' program
  843. will find the Linux virtual console implementation familiar.
  844.   The kernel is able  to emulate 387-FPU instructions itself,  so that
  845. systems without  a  math coprocessor  can  run programs  that  require
  846. floating-point math instructions.
  847.   Linux supports various filesystem  types for storing data.   Various
  848. filesystems,  such as  the  ext2fs  filesystem,  have  been  developed
  849. specifically for Linux.  Other  filesystem types, such as  the Minix-1
  850. and Xenix filesystems, are also supported.  The  MS-DOS filesystem has
  851. been implemented as well, allowing you to access MS-DOS  files on hard
  852. drive or floppy directly.  The ISO 9660 CD-ROM filesystem  type, which
  853. reads all standard formats of CD-ROMs, is also supported.   We'll talk
  854. more about filesystems in Chapters 2 and 4.
  855.   Linux  provides  a complete  implementation  of  TCP/IP  networking.
  856. This includes device  drivers for  many popular  Ethernet cards,  SLIP
  857. (Serial Line  Internet  Protocol,  allowing  you to  access  a  TCP/IP
  858. network via  a  serial  connection),   PLIP  (Parallel  Line  Internet
  859. Protocol), PPP (Point-to-Point Protocol),  NFS (Network File  System),
  860. and so on.    The complete  range of  TCP/IP clients  and services  is
  861. supported, such as FTP, telnet, NNTP, and SMTP. We'll  talk more about
  862. networking in Chapter 5.
  863. 1.4.   Software Features                                             6
  864. _______________________________________________________________________
  865.  
  866.   The Linux  kernel  is developed  to use  the special  protected-mode
  867. features of the  Intel 80386  and 80486  processors.   In  particular,
  868. Linux  makes  use  of   the  protected-mode  descriptor-based   memory
  869. management paradigm and many of  the other advanced features of  these
  870. processors.   Anyone  familiar with  80386 protected-mode  programming
  871. knows that this chip  was designed for  a multitasking system such  as
  872. UNIX (or, actually, Multics).  Linux exploits this functionality.
  873.   The Linux  kernel supports  demand-paged loaded executables.    That
  874. is, only  those segments  of a  program  which are  actually used  are
  875. read into memory  from disk.    Also, copy-on-write  pages are  shared
  876. among executables, meaning that if several instances of a  program are
  877. running at once, they  will share pages  in physical memory,  reducing
  878. overall memory usage.
  879.   In order  to increase  the amount  of available  memory, Linux  also
  880. implements disk  paging:   that  is,  up to  256 megabytes  of  ``swap
  881. space''(2) can  be  allocated on  disk.    When  the  system  requires
  882. more physical memory, it  will swap out  inactive pages to disk,  thus
  883. allowing you  to run  larger applications  and support  more users  at
  884. once.  However,  swap is no substitute  for physical RAM---it is  much
  885. slower due to drive access latency times.
  886.   The kernel also implements  a unified memory pool for  user programs
  887. and disk cache.  In this way, all free memory is used for caching, and
  888. the cache is reduced when running large programs.
  889.   Executables use  dynamically linked shared  libraries, meaning  that
  890. executables share common library code  in a single library file  found
  891. on disk, not unlike the SunOS  shared library mechanism.   This allows
  892. executable files to occupy much  less space on disk,  especially those
  893. that use many  library functions.   There  are also  statically-linked
  894. libraries for  those who  wish  to use  object debugging  or  maintain
  895. ``complete'' executables without the need  for shared libraries to  be
  896. in place.  Linux shared libraries are dynamically linked  at run-time,
  897. allowing the programmer to replace modules of the libraries with their
  898. own routines.
  899.   To  facilitate debugging,  the  Linux  kernel  does core  dumps  for
  900. post-mortem analysis.  Using a core dump and an executable linked with
  901. debugging support, it is possible  to determine what caused  a program
  902. to crash.
  903.  
  904.  
  905. 1.4 Software Features
  906.  
  907. In this  section,   we'll  introduce  you  to  many  of  the  software
  908. applications available for Linux,  and talk about  a number of  common
  909. computing tasks.  After all, the most important part of  the system is
  910. ----------------------------
  911.  2. Swap space  is inappropriately  named:  entire  processes are  not
  912. swapped, but rather individual pages.  Of course, in many cases entire
  913. processes will be swapped out, but this is not neccessarily always the
  914. case.
  915. 1.4.   Software Features                                             7
  916. _______________________________________________________________________
  917.  
  918. the wide range of software  available for it.   The fact that most  of
  919. this software is freely distributable is even more impressive.
  920.  
  921. 1.4.1 Basic commands and utilities
  922.  
  923. Virtually every  utility that  you would  expect to  find on  standard
  924. implementations of UNIX has been ported to Linux.  This includes basic
  925. commands such as ls,  awk, tr,  sed, bc, more,  and so on.   You  name
  926. it, Linux has  it.   Therefore, you can  expect your familiar  working
  927. environment on other  UNIX systems  to be  duplicated on Linux.    All
  928. of the  standard commands  and utilities  are there.    (Novice  Linux
  929. users should see  Chapter 3 for  an introduction  to these basic  UNIX
  930. commands.)
  931.   Many text editors  are available, including vi,  ex, pico, jove,  as
  932. well as GNU Emacs and variants such as Lucid Emacs (which incorporates
  933. extensions for use  under X Windows)  and joe.   Whatever text  editor
  934. you're accustomed to using has more than likely been ported  to Linux.
  935.  
  936.   The choice of a text editor is an interesting one.   Many UNIX users
  937. still use ``simple''  editors such as  vi (in  fact, the author  wrote
  938. this book using vi  under Linux).   However, vi has many  limitations,
  939. due to  its  age,  and  more  modern (and  complex)  editors  such  as
  940. Emacs are gaining popularity.   Emacs  supports a complete  LISP-based
  941. macro language and interpreter, a  powerful command syntax, and  other
  942. fun-filled extensions.   Emacs macro  packages exist  to allow you  to
  943. read electronic  mail  and news,  edit  the contents  of  directories,
  944. and even engage in  an artificially intelligent psychotherapy  session
  945. (indispensible for stressed-out Linux hackers).
  946.   One  interesting note  is that  most of  the  basic Linux  utilities
  947. are GNU software.   These GNU utilities support advanced  features not
  948. found in the standard  versions from BSD  or AT&T. For example,  GNU's
  949. version of the vi editor, elvis, includes a structured  macro language
  950. which differs from  the original  AT&T implementation.   However,  the
  951. GNU utilities strive to remain compatible with their BSD and  System V
  952. counterparts.  Many people consider the GNU versions of these programs
  953. superior to the originals.
  954.   The  most important  utility  to  many users  is  the  shell.    The
  955. shell is  a  program  which  reads  and  executes  commands  from  the
  956. user.  In addition, many  shells provide features such as  job control
  957. (allowing the user to manage  several running processes at  once---not
  958. as Orwellian  as  it sounds),  input  and output  redirection,  and  a
  959. command language for writing shell scripts.  A shell script  is a file
  960. containing a program  in the  shell command language,  analogous to  a
  961. ``batch file'' under MS-DOS.
  962.   There are  many  types of  shells available  for Linux.    The  most
  963. important difference  between shells  is the  command language.    For
  964. example, the C Shell (csh)  uses a command language somewhat  like the
  965. C programming language.   The  classic Bourne  Shell uses a  different
  966. command language.   One's  choice of  a shell  is often  based on  the
  967. command language that it provides.  The shell that you use defines, to
  968. 1.4.   Software Features                                             8
  969. _______________________________________________________________________
  970.  
  971. some extent, your working environment under Linux.
  972.   No matter what  shell you're accustomed to,  some version of it  has
  973. probably been ported  to Linux.   The  most popular  shell is the  GNU
  974. Bourne Again Shell (bash), a Bourne shell variant which  includes many
  975. advanced features, such as job  control, command history, command  and
  976. filename completion, an Emacs-like  interface for editing the  command
  977. line, and powerful extensions  to the standard Bourne shell  language.
  978. Another popular shell is tcsh, a version of the C  Shell with advanced
  979. functionality similar to  that found in  bash.   Other shells  include
  980. zsh, a small Bourne-like shell;  the Korn shell (ksh); BSD's ash;  and
  981. rc, the Plan 9 shell.
  982.   What's so important  about these basic utilities?   Linux gives  you
  983. the unique opportunity to tailor a  custom system to your needs.   For
  984. example, if  you're the  only person  who uses  your  system, and  you
  985. prefer to  exclusively use  the vi  editor,  and bash  as your  shell,
  986. there's no reason to  install other editors  or shells.   The ``do  it
  987. yourself'' attitude is prevalent among Linux hackers and users.
  988.  
  989. 1.4.2 Text processing and word processing
  990.  
  991. Almost every  computer user  has  a need  for  some kind  of  document
  992. preparation system.   (How many computer  enthusiasts do you know  who
  993. still use pen and paper?   Not many, we'll  wager.)  In the  PC world,
  994. word processing is  the norm:   it involves  editing and  manipulating
  995. text (often  in  a ``What-You-See-Is-What-You-Get''  environment)  and
  996. producing printed copies of the  text, complete with figures,  tables,
  997. and other garnishes.
  998.   In  the UNIX  world,  text processing  is  much more  common,  which
  999. is quite  different than  the classical  concept  of word  processing.
  1000. With a text  processing system, text  is entered  by the author  using
  1001. a ``typesetting language'',  which describes  how the  text should  be
  1002. formatted.    Instead of  entering  the  text within  a  special  word
  1003. processing environment,  the  source may  be  modified with  any  text
  1004. editor such as vi or Emacs.  Once the source text  (in the typesetting
  1005. language) is  complete, the  user  formats the  text  with a  separate
  1006. program, which converts the source to a format suitable  for printing.
  1007. This is somewhat analogous to programming in a language such as C, and
  1008. ``compiling'' the document into a printable form.
  1009.   There are many text processing systems available for Linux.   One is
  1010. groff, the GNU version of the classic nroff text  formatter originally
  1011. developed by Bell Labs and still used on many UNIX  systems worldwide.
  1012. Another modern  text processing  system is  TeX,  developed by  Donald
  1013. Knuth of computer science fame.   Dialects of TeX, such as  LaTeX, are
  1014. also available.
  1015.   Text processors such  as TeX and groff  differ mostly in the  syntax
  1016. of their formatting languages.   The  choice of one formatting  system
  1017. over another  is  also based  upon  what  utilities are  available  to
  1018. satisfy your needs, as well as personal taste.
  1019.   For example, some  people consider the groff formatting  language to
  1020. be a bit obscure, so they  use TeX, which is more readable  by humans.
  1021. 1.4.  Software Features                                              9
  1022. _______________________________________________________________________
  1023.  
  1024. However, groff is capable of producing plain ASCII output, viewable on
  1025. a terminal, while TeX is  intended primarily for output to  a printing
  1026. device.  However, various  programs exist to produce plain  ASCII from
  1027. TeX-formatted documents, or to convert TeX to groff, for example.
  1028.   Another text processing system is texinfo, an extension  to TeX used
  1029. for software documentation by the  Free Software Foundation.   texinfo
  1030. is capable of  producing a  printed document,  or an  online-browsable
  1031. hypertext ``Info'' document from a single source file.  Info files are
  1032. the main format of documentation used by GNU software such as Emacs.
  1033.   Text  processors are  used  widely in  the computing  community  for
  1034. producing papers, theses, magazine articles, and books (in  fact, this
  1035. book was  produced using  LaTeX). The  ability to  process the  source
  1036. language as  a plain  text  file opens  the  door to  many  extensions
  1037. to the  text processor  itself.    Because  source documents  are  not
  1038. stored in  an  obscure format,  readable  only  by a  particular  word
  1039. processor, programmers are able  to write parsers and translators  for
  1040. the formatting language, extending the system.
  1041.   What  does such  a  formatting language  look  like?    In  general,
  1042. the formatting language  source consists  mostly of  the text  itself,
  1043. along with ``control codes'' to  produce a particular effect,  such as
  1044. changing fonts, setting margins, creating lists, and so on.
  1045.   As an example, take the following text:
  1046.  
  1047.     Mr.  Torvalds:
  1048.  
  1049.     We are  very  upset  with  your  current  plans  to  implement
  1050.     post-hypnotic suggestion in  the Linux  terminal driver  code.
  1051.     We feel this way for three reasons:
  1052.  
  1053.  
  1054.     1.  Planting subliminal messages in the terminal driver is not
  1055.         only immoral, it is a waste of time;
  1056.  
  1057.     2.  It has been proven that ``post-hypnotic  suggestions'' are
  1058.         ineffective when used upon unsuspecting UNIX hackers;
  1059.  
  1060.     3.  We have already implemented high-voltage electric  shocks,
  1061.         as a security measure, in the code for login.
  1062.  
  1063.  
  1064.     We hope you will reconsider.
  1065.  
  1066.   This  text would  appear in  the LaTeX  formatting  language as  the
  1067. following:
  1068.  
  1069.     \begin{quote}
  1070.     Mr. Torvalds:
  1071.  
  1072.     We are very upset with your current plans to  implement {\em post-
  1073.     hypnotic
  1074. 1.4.   Software Features                                            10
  1075. _______________________________________________________________________
  1076.  
  1077.     suggestion\/}      in      the       {\bf      Linux}       termi-
  1078.     nal driver code. We feel this
  1079.     way for three reasons:
  1080.     \begin{enumerate}
  1081.     \item    Planting    subliminal     messages    in    the     ker-
  1082.     nel driver is not only
  1083.           immoral, it is a waste of time;
  1084.     \item  It   has   been   proven   that   ``post-hypnotic   sugges-
  1085.     tions'' are ineffective
  1086.           when used upon unsuspecting UNIX hackers;
  1087.     \item   We   have    already   implemented   high-voltage    elec-
  1088.     tric shocks, as a
  1089.           security measure, in the code for {\tt login}.
  1090.     \end{enumerate}
  1091.     We hope you will reconsider.
  1092.     \end{quote}
  1093.  
  1094.   The author enters the  above ``source'' text using any  text editor,
  1095. and generates  the  formatted output  by  processing the  source  with
  1096. LaTeX. At  first glance,  the typesetting  language may  appear to  be
  1097. obscure, but  it's  actually  quite easy  to  learn.    Using  a  text
  1098. processing system enforces typographical standards when writing.   For
  1099. example, all enumerated  lists within a document  will look the  same,
  1100. unless the  author  modifies the  definition  of the  enumerated  list
  1101. ``environment''.    The  primary  goal  is  to  allow  the  author  to
  1102. concentrate on  writing the  actual text,  instead  of worrying  about
  1103. typesetting conventions.
  1104.   WYSIWYG  word  processors are  attractive  for  many  reasons;  they
  1105. provide a  powerful  (and  sometimes  complex)  visual  interface  for
  1106. editing the document.   However, this interface is  inherently limited
  1107. to those aspects of text layout which are accessible to the user.  For
  1108. example, many word  processors provide  a special ``format  language''
  1109. for producing complicated expressions  such as mathematical  formulae.
  1110. This is identical text processing, albeit on a much smaller scale.
  1111.   The subtle benefit of text processing is that  the system allows you
  1112. to specify exactly what you mean.  Also, text processing systems allow
  1113. you to edit the source  text with any text  editor, and the source  is
  1114. easily converted to other formats.  The tradeoff for  this flexibility
  1115. and power is the lack of a WYSIWYG interface.
  1116.   Many  users of  word processors  are used  to  seeing the  formatted
  1117. text as they edit  it.  On  the other hand,  when writing with a  text
  1118. processor, one generally does not worry about how the text will appear
  1119. when formatted.  The writer learns to expect how the  text should look
  1120. from the formatting commands used in the source.
  1121.   There are programs  which allow you  to view the formatted  document
  1122. on a graphics display before printing.  For example,  the xdvi program
  1123. displays a ``device  independent'' file  generated by  the TeX  system
  1124. under the X Windows  environment.   Other software applications,  such
  1125. as xfig,  provide a  WYSIWYG graphics  interface  for drawing  figures
  1126. and diagrams, which are subsequently converted to the  text processing
  1127. 1.4.   Software Features                                            11
  1128. _______________________________________________________________________
  1129.  
  1130. language for inclusion in your document.
  1131.   Admittedly, text  processors such as  nroff were around long  before
  1132. word processing was available.   However, many people still  prefer to
  1133. use text processing, because it  is more versatile and  independent of
  1134. a graphics environment.   In either case,  the idoc word processor  is
  1135. also available for Linux, and before long we expect  to see commercial
  1136. word processors becoming available as  well.  If you  absolutely don't
  1137. want to give up  word processing for  text processing, you can  always
  1138. run MS-DOS, or some other operating system, in addition to Linux.
  1139.   There are  many other  text-processing-related utilities  available.
  1140. The powerful METAFONT  system, used  for designing fonts  for TeX,  is
  1141. included with the Linux  port of TeX.  Other programs include  ispell,
  1142. an interactive  spell  checker  and  corrector;  makeindex,  used  for
  1143. generating indicies in  LaTeX documents;  as  well as  many groff  and
  1144. TeX-based macro packages  for formatting many  types of documents  and
  1145. mathematical texts.  Conversion  programs to translate between TeX  or
  1146. groff source to a myriad of other formats are available.
  1147.  
  1148. 1.4.3 Programming languages and utilities
  1149.  
  1150. Linux provides a complete UNIX programming environment,  including all
  1151. of the standard libraries, programming tools, compilers, and debuggers
  1152. that you would expect to find on other UNIX systems.   Within the UNIX
  1153. software development world,  applications and  systems programming  is
  1154. usually done in C or C++.   The standard C and C++ compiler  for Linux
  1155. is GNU's gcc, which  is an advanced,  modern compiler supporting  many
  1156. options.   It is  also capable  of compiling C++  (including AT&T  3.0
  1157. features) as well as  Objective-C, another object-oriented dialect  of
  1158. C.
  1159.   Besides C and  C++, many other compiled and  interpreted programming
  1160. languages have  been ported  to  Linux,  such as  Smalltalk,  FORTRAN,
  1161. Pascal,  LISP, Scheme,   and Ada  (if  you're  masochistic  enough  to
  1162. program in Ada---we're not going to  stop you).  In addition,  various
  1163. assemblers for writing protected-mode 80386 code are available, as are
  1164. UNIX hacking favorites such  as Perl (the  script language to end  all
  1165. script languages) and Tcl/Tk  (a shell-like command processing  system
  1166. including support for developing simple X Windows applications).
  1167.   The advanced  gdb  debugger has  been ported,  which  allows you  to
  1168.  step through  a program  to find  bugs, or  examine the  cause for  a
  1169. crash using  a core  dump.    gprof, a  profiling utility,  will  give
  1170. you performance statistics  for your program,  letting you know  where
  1171. your program is spending most of  its time executing.  The  Emacs text
  1172. editor provides an interactive editing and compilation environment for
  1173. various programming  languages.    Other tools  include GNU  make  and
  1174. imake, used to manage  compilation of large  applications; and RCS,  a
  1175. system for source locking and revision control.
  1176.   Linux implements  dynamically-linked shared  libraries, which  allow
  1177. binaries to  be much  smaller  as the  subroutine  code is  linked  at
  1178. run-time.  These DLL libraries also allow the  applications programmer
  1179. to override  function definitions with  their own code.   For example,
  1180. 1.4.   Software Features                                            12
  1181. _______________________________________________________________________
  1182.  
  1183. if a  programmer wished  to  write her  own  version of  the  malloc()
  1184. library routine,  the linker would  use the  programmer's new  routine
  1185. instead of the one found in the libraries.
  1186.   Linux is  ideal for  developing UNIX  applications.   It provides  a
  1187. modern programming environment  with all  of the  bells and  whistles.
  1188. Various standards  such as  POSIX.1 are  supported, allowing  software
  1189. written for Linux to be easily ported to other systems.   Professional
  1190. UNIX programmers and  system administrators can  use Linux to  develop
  1191. software at home, and  then transfer the  software to UNIX systems  at
  1192. work.   This not only  can save a  great deal of  time and money,  but
  1193. will also let you work in the  comfort of your own home.(3)   Computer
  1194. Science students  can  use Linux  to  learn  UNIX programming  and  to
  1195. explore other aspects of the system, such as kernel architecture.
  1196.   With Linux,  not only  do you  have access  to the  complete set  of
  1197. libraries and programming  utilities, but you  also have the  complete
  1198. kernel and library source code at your fingertips.
  1199.  
  1200. 1.4.4 The X Window System
  1201.  
  1202. The X  Window  System is  the  standard  graphics interface  for  UNIX
  1203. machines.  It is a powerful environment supporting  many applications.
  1204. Using X Windows, the  user can have  multiple terminal windows on  the
  1205. screen at once,  each one  containing a  different login session.    A
  1206. pointing device such as  a mouse is often  used with the X  interface,
  1207. although it isn't required.
  1208.   Many  X-specific applications  have  been written,  such  as  games,
  1209. graphics utilities, programming  and documentation tools,  and so  on.
  1210. With Linux and X,  your system is  a bona fide  workstation.   Coupled
  1211. with TCP/IP networking,  you can even  display X applications  running
  1212. on other machines  on your Linux  display, as  is possible with  other
  1213. systems running X.
  1214.   The X Window System  was originally developed at MIT, and  is freely
  1215. distributable.    However,  may commercial  vendors  have  distributed
  1216. proprietary enhancements  to the  original X  Windows software.    The
  1217. version of X Windows available for  Linux is known as XFree86,  a port
  1218. of X11R5 made freely distributable  for 80386-based UNIX systems  such
  1219. as Linux.  XFree86 supports a wide range of video  hardware, including
  1220. VGA, Super VGA, and a number  of accelerated video adaptors.   This is
  1221. a complete distribution of  the X Windows  software, containing the  X
  1222. server itself, many applications and utilities, programming libraries,
  1223. and documentation.
  1224.   Standard X applications include xterm (a terminal  emulator used for
  1225. most text-based applications within an  X window); xdm (the  X Session
  1226. Manager, which handles logins); xclock (a simple clock  display); xman
  1227. (an X-based  man page  reader), and  more.   The  many X  applications
  1228.  
  1229. ----------------------------
  1230.  3. The author  uses his Linux  system to develop  and test X  Windows
  1231. applications at home, which  can be directly compiled on  workstations
  1232. elsewhere.
  1233. 1.4.   Software Features                                            13
  1234. _______________________________________________________________________
  1235.  
  1236. available for Linux  are too numerous  to mention  here, but the  base
  1237. XFree86 distribution includes the  ``standard'' applications found  in
  1238. the original MIT release.   Many others are available separately,  and
  1239. theoretically any  application written  for X  Windows should  compile
  1240. cleanly under Linux.
  1241.   The look  and feel  of the X  Windows interface  is controlled to  a
  1242. large extent  by the  window manager.    This friendly  program is  in
  1243. charge of the placement of  windows, the user interface  for resizing,
  1244. iconifying, and moving windows,  the appearance of window frames,  and
  1245. so on.   The standard XFree86  distribution includes twm, the  classic
  1246. MIT window manager, although more advanced window managers such as the
  1247. Open Look Virtual Window Manager (olvwm)  are available as well.   One
  1248. window manager that is  popular among Linux  users is fvwm.   This  is
  1249. a small window manager,  requiring less than  half of the memory  used
  1250. by twm.  It provides a  3-D appearance for windows, as well  a virtual
  1251. desktop---if the user moves the mouse  to the edge of the screen,  the
  1252. entire desktop is shifted as if  the display were much larger  than it
  1253. actually is.  fvwm is  greatly customizable, and allows  all functions
  1254. to be accessed from  the keyboard as  well as the  mouse.  Many  Linux
  1255. distributions use fvwm as the standard window manager.
  1256.   The XFree86 distribution contains programming libraries  and include
  1257. files for those wily programmers  who wish to develop X  applications.
  1258. Various widget  sets,  such  as  Athena,  Open  Look,  and  Xaw3D  are
  1259. supported.    All of  the  standard fonts,  bitmaps,  man  pages,  and
  1260. documentation are  included.   PEX  (a programming  interface for  3-D
  1261. graphics) is also supported.
  1262.   Many X  applications programmers  use the  proprietary Motif  widget
  1263. set for development.   Several vendors  sell single and  multiple-user
  1264. licenses  for  a  binary  version  of  Motif  for  Linux.      Because
  1265. Motif itself is  relatively expensive,  not many Linux  users own  it.
  1266. However, binaries statically linked with Motif routines may  be freely
  1267. distributed.  Therefore, if you  write a program using Motif  and wish
  1268. to distribute  it freely,  you  may  provide a  binary so  that  users
  1269. without Motif can use the program.
  1270.   The only major  caveats with X Windows  are the hardware and  memory
  1271. requirements.  A  386 with 4  megabytes of RAM  is capable of  running
  1272. X, but  8 megabytes  or more  of physical  RAM are  needed  to use  it
  1273. comfortably.  A faster processor  is nice to have as well,  but having
  1274. enough physical RAM is much more  important.  In addition,  to achieve
  1275. really slick video  performance, an  accelerated video  card (such  as
  1276. a local bus  S3-chipset card)  is strongly recommended.    Performance
  1277. ratings in excess  of 140,000  xstones have been  acheived with  Linux
  1278. and XFree86.    With  sufficient hardware,  you'll  find that  running
  1279. X and  Linux is  as fast,  or faster,  than  running X  on other  UNIX
  1280. workstations.
  1281.   In Chapter 5 we'll discuss how to install and use X on your system.
  1282. 1.4.   Software Features                                            14
  1283. _______________________________________________________________________
  1284.  
  1285. 1.4.5 Networking
  1286.  
  1287. Interested in  communicating with  the world?    Yes?    No?    Maybe?
  1288. Linux supports the two primary networking protocols for  UNIX systems:
  1289. TCP/IP  and  UUCP.  TCP/IP  (Transmission   Control  Protocol/Internet
  1290. Protocol, for acronym aficionados) is the set of  networking paradigms
  1291. that allow  systems all  over the  world to  communicate  on a  single
  1292. network known as the Internet.   With Linux, TCP/IP, and  a connection
  1293. to the network, you can communicate with users and machines across the
  1294. Internet via electronic  mail, USENET news,  file transfers with  FTP,
  1295. and more.  There are many Linux systems currently on the Internet.
  1296.   Most  TCP/IP   networks  use  Ethernet   as  the  physical   network
  1297. transport.  Linux supports many popular Ethernet cards  and interfaces
  1298. for personal computers, including  the D-Link pocket Ethernet  adaptor
  1299. for laptops.
  1300.   However, because  not everyone has an  Ethernet drop at home,  Linux
  1301. also supports SLIP (Serial Line Internet Protocol), which allows   you
  1302. to connect to the Internet  via modem.   In order to use SLIP,  you'll
  1303. need to  have access  to a  SLIP server,  a machine  connected to  the
  1304. network which allows dial-in access.  Many businesses and universities
  1305. provide such SLIP  servers.   In  fact, if  your Linux  system has  an
  1306. Ethernet connection as well as a modem, you can configure it as a SLIP
  1307. server for other hosts.
  1308.   NFS (Network  File System)  allows your system  to seamlessly  share
  1309. files with  other  machines  on  the  network.    FTP  (File  Transfer
  1310. Protocol) allows you to transfer files between other machines.   Other
  1311. applications include  sendmail,  a system  for sending  and  receiving
  1312. electronic mail using  the SMTP protocol;  NNTP-based electronic  news
  1313. systems such as C-News and INN;  telnet, rlogin, and rsh,  which allow
  1314. you to login and  execute commands on  other machines on the  network;
  1315. and finger,  which allows  you to  get information  on other  Internet
  1316. users.   There  are literally  tons of  TCP/IP-based applications  and
  1317. protocols out there.
  1318.   The full  range of mail  and news readers  are available for  Linux,
  1319. such as elm, pine, rn, nn, and tin.  Whatever your preference, you can
  1320. configure your Linux system  to send and  receive electronic mail  and
  1321. news from all over the world.
  1322.   If  you have  experience  with  TCP/IP applications  on  other  UNIX
  1323. systems, Linux will be  very familiar to you.   The system provides  a
  1324. standard socket programming interface, so virtually any  program which
  1325. uses TCP/IP can be ported to Linux.  The Linux X  server also supports
  1326. TCP/IP, allowing you to display applications running on  other systems
  1327. on your Linux display.
  1328.   In  Chapter 5  we'll  discuss  configuration and  setup  of  TCP/IP,
  1329. including SLIP, for Linux.
  1330.   UUCP (UNIX-to-UNIX  Copy)  is an  older mechanism  used to  transfer
  1331. files, electronic  mail, and  electronic news  between UNIX  machines.
  1332. Classically, UUCP  machines connected  to each  other  over the  phone
  1333. lines via modem, but UUCP is  able to transport over a  TCP/IP network
  1334. as well.   If you do  not have access  to a TCP/IP  network or a  SLIP
  1335. 1.4.   Software Features                                            15
  1336. _______________________________________________________________________
  1337.  
  1338. server, you can configure  your system to  send and receive files  and
  1339. electronic mail using UUCP. See Chapter 5 for more information.
  1340.  
  1341. 1.4.6 Telecommunications and BBS software
  1342.  
  1343. If you  have a  modem,  you will  be able  to  communicate with  other
  1344. machines using one  of the  telecommunications packages available  for
  1345. Linux.  Many people use telecommunications software to access bulletin
  1346. board systems (BBSs),  as well as commercial  online services such  as
  1347. Prodigy, CompuServe,  and America  On-Line.   Other  people use  their
  1348. modems to  connect to  a UNIX  system  at work  or school.    You  can
  1349. even use your modem and  Linux system to send and  receive facsimiles.
  1350. Telecommunications software under Linux is very similar to  that found
  1351. under MS-DOS or other operating systems.   Anyone who has ever  used a
  1352. telecommunications package will find the Linux equivalent familiar.
  1353.   One  of  the  most popular  communications  packages  for  Linux  is
  1354. Seyon, an X application providing a customizable, ergonomic interface,
  1355. with built-in  support for  various file  transfer  protocols such  as
  1356. Kermit, ZModem, and so on.  Other telecommunications  programs include
  1357. C-Kermit, pcomm,  and minicom.   These  are similar to  communications
  1358. programs found on other operating systems, and are quite easy to use.
  1359.   If  you do  not  have access  to a  SLIP  server (see  the  previous
  1360. section), you can use term to  multiplex your serial line.   term will
  1361. allow you to open  multiple login sessions  over the modem  connection
  1362. to a remote machine.   term will also  allow you to redirect X  client
  1363. connections to your local X server, through the serial  line, allowing
  1364. you to display remote  X applications on your  Linux system.   Another
  1365. software package, KA9Q, implements a similar SLIP-like interface.
  1366.   Running  a bulletin  board system  (BBS) is  a  favorite hobby  (and
  1367. means of income) for many people.  Linux supports a wide  range of BBS
  1368. software, most of which  is more powerful  than what is available  for
  1369. other operating systems.  With a  phone line, a modem, and  Linux, you
  1370. can turn your  system into  a BBS,  providing dial-in  access to  your
  1371. system to users worldwide.   BBS software for Linux includes  XBBS and
  1372. the UniBoard BBS packages.
  1373.   Most BBS  software locks  the user  into a  menu-based system  where
  1374. only certain functions and applications are available.  An alternative
  1375. to BBS access  is full UNIX  access, which would  allow users to  dial
  1376. into your  system and  login as  a regular  user.    While this  would
  1377. require a  fair  amount of  maintenance  on  the part  of  the  system
  1378. administrator, it can be done,  and providing public UNIX  access from
  1379. your Linux  system is  not  difficult to  do.    Along with  a  TCP/IP
  1380. network, you can provide electronic  mail and news access to  users on
  1381. your system.
  1382.   If you do  not have access to a  TCP/IP network or UUCP feed,  Linux
  1383. will also allow  you to  communicate with  a number  of BBS  networks,
  1384. such as FidoNet, with which you can exchange electronic  news and mail
  1385. via the phone line.   More  information on telecommunications and  BBS
  1386. software under Linux can be found in Chapter 5.
  1387. 1.4.   Software Features                                            16
  1388. _______________________________________________________________________
  1389.  
  1390. 1.4.7 Interfacing with MS-DOS
  1391.  
  1392. Various utilities exist  to interface  with the world  of MS-DOS.  The
  1393. most well-known application is the Linux MS-DOS Emulator, which allows
  1394. you to run  many MS-DOS applications  directly from  Linux.   Although
  1395. Linux and MS-DOS are completely different operating systems, the 80386
  1396. protected-mode environment allows certain tasks  to behave as if  they
  1397. were running in 8086-emulation mode, as MS-DOS applications do.
  1398.   The MS-DOS  emulator is  still under development,  yet many  popular
  1399. applications  run  under  it.      Understandably,   however,   MS-DOS
  1400. applications which use bizarre or esoteric features of the  system may
  1401. never be supported,  because it  is only  an emulator.   For  example,
  1402. you wouldn't expect  to be able  to run any  programs which use  80386
  1403. protected-mode features, such  as Microsoft  Windows (in 386  enhanced
  1404. mode, that is).
  1405.   Applications which run successfully under the  Linux MS-DOS Emulator
  1406. include 4DOS (a  command interpreter), Foxpro  2.0, Harvard  Graphics,
  1407. MathCad, Stacker  3.1,  Turbo Assembler,  Turbo C/C++,  Turbo  Pascal,
  1408. Microsoft Windows 3.0 (in real mode),  and WordPerfect 5.1.   Standard
  1409. MS-DOS commands and utilities (such as PKZIP, and so on) work with the
  1410. emulator as well.
  1411.   The MS-DOS Emulator is meant mostly as an ad  hoc solution for those
  1412. people who need MS-DOS only for a few applications, but  use Linux for
  1413. everything else.   It's not meant to  be a complete implementation  of
  1414. MS-DOS. Of course, if the Emulator doesn't satisfy your needs, you can
  1415. always run MS-DOS as well as Linux on the same system.  Using the LILO
  1416. boot loader, you can  specify at boot  time which operating system  to
  1417. start.  Linux can coexist with other operating systems,  such as OS/2,
  1418. as well.
  1419.   Linux provides a  seamless interface for transferring files  between
  1420. Linux and MS-DOS. You  can mount an  MS-DOS partition or floppy  under
  1421. Linux, and directly access MS-DOS files as you would any other.
  1422.   Currently  under  development   is  a  project  known  as   WINE---a
  1423. Microsoft Windows emulator for the X Window System under Linux.   Once
  1424. WINE is complete,  users will be able  to run MS-Windows  applications
  1425. directly from Linux.  This is similar to the  proprietary WABI Windows
  1426. emulator from Sun Microsystems.  At the time of this  writing, WINE is
  1427. still in the early stages of development, but the outlook is good.
  1428.   In  Chapter 5  we'll  talk  about  the MS-DOS  tools  available  for
  1429. Linux.
  1430.  
  1431. 1.4.8 Other applications
  1432.  
  1433. A host  of miscellany  is available  for Linux,  as  one would  expect
  1434. from such  a  hodgepodge operating  system.    Linux's  primary  focus
  1435. is currently  for  personal  UNIX  computing,   but  this  is  rapidly
  1436. changing.    Business  and  scientific  software  is  expanding,   and
  1437. commercial software vendors are beginning to contribute to the growing
  1438. pool of applications.
  1439.   Several  relational databases  are  available for  Linux,  including
  1440. 1.4.   Software Features                                            17
  1441. _______________________________________________________________________
  1442.  
  1443. Postgres, Ingres, and  Mbase.   These are full-featured,  professional
  1444. client/server database applications  similar to  those found on  other
  1445. UNIX platforms.  /rdb,  a commercial database system, is  available as
  1446. well.
  1447.   Scientific computing  applications  include FELT  (a finite  element
  1448. analysis tool); gnuplot  (a plotting  and data analysis  application);
  1449. Octave (a symbolic mathematics package, similar to MATLAB); xspread (a
  1450. spreadsheet calculator);  xfractint, an  X-based port  of the  popular
  1451. Fractint fractal  generator;  xlispstat  (a statistics  package),  and
  1452. more.  Other applications include Spice (a circuit design and analysis
  1453. tool) and Khoros (an image/digital signal processing and visualization
  1454. system).
  1455.   Of course,  there are many more  such applications which have  been,
  1456. and can be,  ported to  run on Linux.   Whatever  your field,  porting
  1457. UNIX-based applications  to  Linux should  be  quite  straightforward.
  1458. Linux provides a  complete UNIX programming  interface, sufficient  to
  1459. serve as the base for any scientific application.
  1460.   As with any operating system,  Linux has its share of games.   These
  1461. include classic text-based  dungeon games such  as Nethack and  Moria;
  1462. MUDs (multi-user dungeons,  which allow  many users to  interact in  a
  1463. text-based adventure) such as DikuMUD  and TinyMUD; as well as  a slew
  1464. of X games  such as xtetris,  netrek, and Xboard  (the X11 version  of
  1465. gnuchess).  The  popular shoot-em-up arcade-style  Doom has also  been
  1466. ported to Linux.
  1467.   For  audiophiles, Linux  has  support for  various sound  cards  and
  1468. related software,  such as  CDplayer (a  program which  can control  a
  1469. CD-ROM drive as a conventional  CD player, surprisingly enough),  MIDI
  1470. sequencers and editors  (allowing you  to compose  music for  playback
  1471. through a synthesizer or other MIDI-controlled instrument),  and sound
  1472. editors for digitized sounds.
  1473.   Can't find the application  you're looking for?  The  Linux Software
  1474. Map, described  in  Appendix  A,  contains  a list  of  many  software
  1475. packages which have been written and ported to Linux.  While this list
  1476. is far from complete, it contains  a great deal of software.   Another
  1477. way to find Linux applications is to look at the INDEX  files found on
  1478. Linux FTP sites, if you have  Internet access.  Just by  poking around
  1479. you'll find a great deal of software just waiting to be played with.
  1480.   If you absolutely can't  find what you need, you can  always attempt
  1481. to port the application from another  platform to Linux.   Most freely
  1482. distributable UNIX-based  software  will  compile on  Linux  with  few
  1483. problems.   Or,  if  all else  fails, you  can  write the  application
  1484. yourself.    If it's  a  commercial  application you're  looking  for,
  1485. there may  be a  free ``clone''  available.    Or,  you can  encourage
  1486. the software company  to consider  releasing a  Linux binary  version.
  1487. Several individuals have contacted software companies, asking  them to
  1488. port their applications to Linux, and have met with various degrees of
  1489. success.
  1490. 1.5.   About Linux's Copyright                                      18
  1491. _______________________________________________________________________
  1492.  
  1493. 1.5 About Linux's Copyright
  1494.  
  1495. Linux is covered by what is  known as the GNU General  Public License,
  1496. or GPL. The GPL was developed for the GNU project by the Free Software
  1497. Foundataion.   It makes a  number of  provisions for the  distribution
  1498. and modification of ``free software''.  ``Free'' in this  sense refers
  1499. to freedom,  not  just cost.    The  GPL has  always been  subject  to
  1500. misinterpretation, and  we hope  that this  summary will  help you  to
  1501. understand the extent and goals of the GPL and its effect on Linux.  A
  1502. complete copy of the GPL is included in Appendix E.
  1503.   Originally,  Linus  Torvalds released  Linux  under a  license  more
  1504. restrictive than  the GPL,  which allowed  the software  to be  freely
  1505. distributed and modified, but  prevented any money changing hands  for
  1506. its distribution and use.  On the other hand, the GPL allows people to
  1507. sell and make profit  from free software, but  does not allow them  to
  1508. restrict the right for others to distribute the software in any way.
  1509.   First, it should be explained that ``free software''  covered by the
  1510. GPL is not in the public  domain.  Public domain software  is software
  1511. which is  not  copyrighted, and  is  literally  owned by  the  public.
  1512. Software covered by  the GPL,  on the  other hand,  is copyrighted  to
  1513. the author or  authors.   This  means that the  software is  protected
  1514. by standard international copyright laws,  and that the author  of the
  1515. software is legally defined.  Just because the software  may be freely
  1516. distributed does not mean that it is in the public domain.
  1517.   GPL-licensed  software  is  also  not  ``shareware''.     Generally,
  1518. ``shareware'' software is owned and copyrighted by the author, but the
  1519. author requires users to send in money for its use after distribution.
  1520. On the other hand, software covered by the GPL may  be distributed and
  1521. used free of charge.
  1522.   The GPL  also allows people  to take and  modify free software,  and
  1523. distribute their own versions of the  software.  However,  any derived
  1524. works from GPL  software must  also be  covered by the  GPL. In  other
  1525. words, a company could  not take Linux, modify  it, and sell it  under
  1526. a restrictive license.   If any software  is derived from Linux,  that
  1527. software must be covered by the GPL as well.
  1528.   The  GPL allows  free  software  to  be distributed  and  used  free
  1529. of charge.    However,  it also  allows a  person  or organization  to
  1530. distribute GPL software  for a  fee, and  even to make  a profit  from
  1531. its sale and  distribution.   However,  in selling  GPL software,  the
  1532. distributor cannot take those rights away from the purchaser; that is,
  1533. if you purchase GPL software from some source, you  may distribute the
  1534. software for free, or sell it yourself as well.
  1535.   This might sound like  a contradiction at first.  Why  sell software
  1536. for profit when  the GPL  allows anyone  to obtain it  for free?    As
  1537. an example,  let's say that  some company  decided to  bundle a  large
  1538. amount of free software on a  CD-ROM and distribute it.   That company
  1539. would need to charge  for the overhead  of producing and  distributing
  1540. the CD-ROM, and the  company may even decide  to make profit from  the
  1541. sales of software.  This is allowed by the GPL.
  1542.   Organizations  which   sell  free   software  must  follow   certain
  1543. 1.6.   The Design and Philosophy of Linux                           19
  1544. _______________________________________________________________________
  1545.  
  1546. restrictions set forth  in the  GPL. First, they  cannot restrict  the
  1547. rights of users who  purchase the software.   This  means that if  you
  1548. buy a CD-ROM of GPL software, you can copy and  distribute that CD-ROM
  1549. free of charge, or  resell it yourself.   Secondly, distributors  must
  1550. make it  obvious to  users  that the  software  is indeed  covered  by
  1551. the GPL.  Thirdly,  distributors must  provide,  free of  charge,  the
  1552. complete source code for  the software being  distributed.  This  will
  1553. allow anyone who purchases GPL software to make modifications  of that
  1554. software.
  1555.   Allowing a company  to distribute and sell  free software is a  very
  1556. good thing.    Not everyone  has access  to the  Internet to  download
  1557. software, such  as Linux,  for  free.   The  GPL  allows companies  to
  1558. sell and distribute  software to  those people  who do  not have  free
  1559. (cost-wise) access to the software.   For example,  many organizations
  1560. sell Linux  on diskette,  tape, or  CD-ROM via  mail  order, and  make
  1561. profit from these sales.   The developers of  Linux may never see  any
  1562. of this profit; that is the understanding that is  reached between the
  1563. developer and the distributor  when software is  licensed by the  GPL.
  1564. In other words, Linus knew that companies may wish to  sell Linux, and
  1565. that he may not see a penny of the profits from those sales.
  1566.   In the free software world,  the important issue is not money.   The
  1567. goal of free software  is always to  develop and distribute  fantastic
  1568. software and  to allow  anyone to  obtain and  use it.    In the  next
  1569. section, we'll discuss how this applies to the development of Linux.
  1570.  
  1571.  
  1572. 1.6 The Design and Philosophy of Linux
  1573.  
  1574. When new users encounter Linux,  they often have a  few misconceptions
  1575. and false expectations  of the system.   Linux  is a unique  operating
  1576. system, and it is important to understand its philosophy and design in
  1577. order to use it effectively.  Time enough for a soapbox.   Even if you
  1578. are an aged UNIX guru, what follows is probably of interest to you.
  1579.   In  commercial  UNIX  development  houses,   the  entire  system  is
  1580. developed with  a rigorous  policy of  quality assurance,  source  and
  1581. revision  control  systems,  documentation,  and   bug  reporting  and
  1582. resolution.  Developers are not  allowed to add features or  to change
  1583. key sections of code on  a whim:  they  must validate the change as  a
  1584. response to a bug report and consequently ``check in'' all  changes to
  1585. the source control system,  so that the changes  can be backed out  if
  1586. necessary.  Each developer is assigned one or more parts of the system
  1587. code, and only  that developer may  alter those  sections of the  code
  1588. while it is ``checked out''.
  1589.   Internally,   the  quality   assurance   department  runs   rigorous
  1590. regression test suites on each new  pass of the operating system,  and
  1591. reports any bugs.  It  is the responsibility of the developers  to fix
  1592. these bugs as reported.  A complicated system of  statistical analysis
  1593. is employed to  ensure that  a certain  percentage of  bugs are  fixed
  1594. before the next  release, and  that the  operating system  as a  whole
  1595. passes certain release criteria.
  1596.   In all, the process  used by commercial UNIX developers  to maintain
  1597. 1.6.   The Design and Philosophy of Linux                           20
  1598. _______________________________________________________________________
  1599.  
  1600. and support their code is  very complicated, and quite  reasonably so.
  1601. The company must  have quantitative  proof that the  next revision  of
  1602. the operating system  is ready  to be  shipped;  hence, the  gathering
  1603. and analysis of statistics  about the operating system's  performance.
  1604. It is  a big  job to  develop a  commercial UNIX  system, often  large
  1605. enough to employ hundreds (if not thousands) of  programmers, testers,
  1606. documentors,  and  administrative  personel.     Of  course,   no  two
  1607. commercial UNIX vendors are alike, but you get the general picture.
  1608.   With  Linux, you  can  throw out  the  entire concept  of  organized
  1609. development, source  control  systems,  structured bug  reporting,  or
  1610. statistical analysis.  Linux is, and more than likely  always will be,
  1611. a hacker's operating system.(4)
  1612.   Linux is primarily developed as a group effort  by volunteers on the
  1613. Internet from all  over the world.   Across  the Internet and  beyond,
  1614. anyone with enough know-how has  the opportunity to aid in  developing
  1615. and debugging the kernel, porting new software, writing documentation,
  1616. or helping new  users.   There is  no single organization  responsible
  1617. for developing the  system.   For the most  part, the Linux  community
  1618. communicates via  various mailing  lists  and USENET  newsgroups.    A
  1619. number of conventions  have sprung up  around the development  effort:
  1620. for example,  anyone  wishing  to  have  their code  included  in  the
  1621. ``official'' kernel should mail  it to Linus  Torvalds, which he  will
  1622. test and include in the kernel (as long as it doesn't  break things or
  1623. go against the overall design of the system, he will  more than likely
  1624. include it).
  1625.   The  system itself  is designed  with  a very  open-ended,  feature-
  1626. minded approach.    While  recently the  number  of new  features  and
  1627. critical changes to the  system have diminished,  the general rule  is
  1628. that a new  version of  the kernel  will be released  about every  few
  1629. months (sometimes even more frequently than this).  Of course, this is
  1630. a very rough figure:   it depends on  a several factors including  the
  1631. number of bugs to be fixed, the amount of feedback  from users testing
  1632. pre-release versions of the code,  and the amount of sleep  that Linus
  1633. has had this week.
  1634.   Let it  suffice to  say that not  every single  bug has been  fixed,
  1635. and not every problem  ironed out between  releases.   As long as  the
  1636. system appears to be free of  critical or oft-manifesting bugs,  it is
  1637. considered ``stable'' and new revisions will be released.   The thrust
  1638. behind Linux development is not an effort to release perfect, bug-free
  1639. code:  it is to  develop a free implementation  of UNIX. Linux is  for
  1640. the developers, more than anyone else.
  1641.   Anyone who has a  new feature or software application to add  to the
  1642. system generally makes it available in an ``alpha''   stage---that is,
  1643. a stage for testing by  those brave or unwary  users who want to  bash
  1644.  
  1645. ----------------------------
  1646.  4. What I mean by ``hacker'' is a feverishly dedicated  programmer, a
  1647. person who enjoys exploiting computers and generally doing interesting
  1648. things with them.   This is  in contrast to  the common denotation  of
  1649. ``hacker'' as a computer wrongdoer or outlaw.
  1650. 1.6.   The Design and Philosophy of Linux                           21
  1651. _______________________________________________________________________
  1652.  
  1653. out problems with the  initial code.   Because the Linux community  is
  1654. largely based on the Internet,  alpha software is usually  uploaded to
  1655. one or more  of the  various Linux FTP  sites (see  Appendix C) and  a
  1656. message posted to one of the Linux USENET newsgroups about  how to get
  1657. and test the code.   Users  who download and  test alpha software  can
  1658. then mail results, bug fixes, or questions to the author.
  1659.   After the initial  problems in the alpha  code have been fixed,  the
  1660. code enters  a ``beta''  stage,   in  which it  is usually  considered
  1661. stable but  not complete  (that  is,  it works,  but  not all  of  the
  1662. features may  be  present).    Otherwise,  it  may go  directly  to  a
  1663. ``final'' stage  in  which the  software  is considered  complete  and
  1664. usable.  For kernel  code, once it  is complete the developer may  ask
  1665. Linus to include it in the  standard kernel, or as an  optional add-on
  1666. feature to the kernel.
  1667.   Keep in  mind that  these are  only conventions---not rules.    Some
  1668. people feel so confident with  their software that they don't  need to
  1669. release an alpha or test version.  It is always up to the developer to
  1670. make these decisions.
  1671.   You might be amazed that such a nonstructured  system of volunteers,
  1672. programming and debugging a complete  UNIX system, could get  anything
  1673. done at all.   As it turns  out, it is one  of the most efficient  and
  1674. motivated development efforts ever employed.  The entire  Linux kernel
  1675. was written from scratch, without employing any code  from proprietary
  1676. sources.  A great deal of work was put forth by volunteers to port all
  1677. of the free software  under the sun  to the Linux  system.   Libraries
  1678. were written and ported,  filesystems developed, and hardware  drivers
  1679. written for many popular devices.
  1680.   The Linux software is  generally released as a distribution,   which
  1681. is a set  of pre-packaged  software making up  an entire  system.   It
  1682. would be quite  difficult for most  users to  build a complete  system
  1683. from the ground up,  starting with the  kernel, adding utilities,  and
  1684. installing all of  the necessary  software by  hand.   Instead,  there
  1685. are a number of software  distributions including everything that  you
  1686. need to  install and  run  a complete  system.    Again, there  is  no
  1687. standard distribution---there are many, each with their own advantages
  1688. and disadvantages.  We'll talk more about the various  available Linux
  1689. distributions in Section 2.1.
  1690.   Despite the completeness of the Linux software, you  will still need
  1691. a bit of  UNIX know-how  to install  and run a  complete system.    No
  1692. distribution of Linux is completely  bug-free, so you may  be required
  1693. to fix small  problems by  hand after  installation.   Running a  UNIX
  1694. system is not an easy task, not even for commercial  versions of UNIX.
  1695. If you're  serious about  Linux,  bear in  mind that  it  will take  a
  1696. considerable amount of effort and  attention on your part to  keep the
  1697. system running and  take care  of things:   this is  true of any  UNIX
  1698. system, and Linux is  no exception.   Because of the diversity of  the
  1699. Linux community and the many needs which the software is attempting to
  1700. meet, not eveything can be taken care of for you all of the time.
  1701. 1.6.   The Design and Philosophy of Linux                           22
  1702. _______________________________________________________________________
  1703.  
  1704. 1.6.1 Hints for UNIX novices
  1705.  
  1706. Installing and using your  own Linux system  does not require a  great
  1707. deal of background in  UNIX. In fact,  many UNIX novices  successfully
  1708. install Linux  on  their systems.     This is  a  worthwhile  learning
  1709. experience, but keep in mind that it can be very  frustrating to some.
  1710. If you're lucky,  you will  be able  to install and  start using  your
  1711. Linux system without any UNIX background.  However, once you are ready
  1712. to delve into  the more  complex tasks  of running  Linux---installing
  1713. new software, recompiling the kernel, and so forth---having background
  1714. knowledge in UNIX is going to be a necessity.
  1715.   Fortunately,  by   running  your  own  Linux  system  you   will  be
  1716. able to  learn  the essentials  of  UNIX  necessary for  these  tasks.
  1717. This book  contains  a  good  deal  of information  to  help  you  get
  1718. started---Chapter 3 is a tutorial covering UNIX basics, and  Chapter 4
  1719. contains information on Linux system administration.  You may  wish to
  1720. read these chapters before you  attempt to install Linux at  all---the
  1721. information contained therein will prove  to be invaluable should  you
  1722. run into problems.
  1723.   Nobody can expect  to go from being a  UNIX novice to a  UNIX system
  1724. administrator overnight.  No implementation of UNIX is expected to run
  1725. trouble- and maintenance-free.   You  must be  aptly prepared for  the
  1726. journey which lies ahead.   Otherwise, if you're new to UNIX,  you may
  1727. very well become overly frustrated with the system.
  1728.  
  1729. 1.6.2 Hints for UNIX gurus
  1730.  
  1731. Even  those  people  with  years  of  UNIX  programming   and  systems
  1732. administration experience may need assistance before they are  able to
  1733. pick up and install Linux.  There are still aspects of the system that
  1734. UNIX wizards will need to be familiar with before diving in.   For one
  1735. thing, Linux is not a commercial UNIX system.  It does  not attempt to
  1736. uphold the same standards as other UNIX systems you have may have come
  1737. across.  To be more  specific, while stability is an  important factor
  1738. in the development of Linux, it is not the only factor.
  1739.   More important, perhaps, is functionality.  In  many cases, new code
  1740. will make it into  the standard kernel even  though it is still  buggy
  1741. and not functionally  complete.   The  assumption is that  it is  more
  1742. important to release code  which users can test  and use than delay  a
  1743. release until it is ``complete''.  As an example,  WINE (the Microsoft
  1744. Windows Emulator for Linux) had  an ``official'' alpha release  before
  1745. it was completely tested.   In this way, the Linux community  at large
  1746. had a chance  to work with  the code,  test it,  and help develop  it,
  1747. while those who found the  alpha code ``good enough'' for  their needs
  1748. could use  it.    Commercial UNIX  vendors  rarely, if  ever,  release
  1749. software in this manner.
  1750.   If  you have  been a  UNIX  systems administrator  for more  than  a
  1751. decade, and have used every  commercial UNIX system under the  Sun (no
  1752. pun intended), Linux  may take some getting  used to.   The system  is
  1753. very modern and dynamic.   A new kernel release is  made approximately
  1754. 1.7.   Differences Between Linux and Other Operating Systems        23
  1755. _______________________________________________________________________
  1756.  
  1757. every few months.  New software is constantly being released.  One day
  1758. your system may be completely  up-to-date with the current trend,  and
  1759. the next day the same system is considered to be in the Stone Age.
  1760.   With all of this  dynamic activity, how can you be expected  to keep
  1761. up with the ever-changing Linux world?  For the most part,  it is best
  1762. to upgrade incrementally;  that is,  upgrade only  those parts of  the
  1763. system that need upgrading,  and then only  when you think an  upgrade
  1764. is necessary.  For  example, if you never  use Emacs, there is  little
  1765. reason to  continuously install  every new  release of  Emacs on  your
  1766. system.  Furthermore,  even if you  are an avid  Emacs user, there  is
  1767. usually no reason to upgrade it  unless you find that some  feature is
  1768. missing that is in the next release.  There is little or  no reason to
  1769. always be on top of the newest version of software.
  1770.   We  hope that  Linux will  meet  or exceed  your expectations  of  a
  1771. homebrew UNIX system.  At the very core of Linux is the spirit of free
  1772. software, of constant  development and  growth.   The Linux  community
  1773. favors expansion over stability,  and that is  a difficult concept  to
  1774. swallow for many people, especially  those so steeped in the  world of
  1775. commercial UNIX. You cannot expect  Linux to be perfect;  nothing ever
  1776. is in the free software world.  However, we believe  that Linux really
  1777. is as complete and useful as any other implementation of UNIX.
  1778.  
  1779.  
  1780. 1.7 Differences Between Linux and Other Operating Systems
  1781.  
  1782. It is important to understand the differences between Linux  and other
  1783. operating systems, such as MS-DOS, OS/2, and other  implementations of
  1784. UNIX for the personal computer.  First of all, it should be made clear
  1785. that Linux will coexist  happily with other  operating systems on  the
  1786. same machine:  that is, you  can run MS-DOS and OS/2 along  with Linux
  1787. on the same system without problems.  There are even  ways to interact
  1788. between the various operating systems, as we'll see.
  1789.  
  1790. 1.7.1 Why use Linux?
  1791.  
  1792. Why use  Linux  instead  of  a  well-known,   well-tested,  and  well-
  1793. documented commercial operating system?  We could give you  a thousand
  1794. reasons.   One of the  most important,  however, is  that Linux is  an
  1795. excellent choice  for personal  UNIX  computing.    If you're  a  UNIX
  1796. software developer, why  use MS-DOS  at home?   Linux  will allow  you
  1797. to develop and test UNIX  software on your PC, including  database and
  1798. X Windows applications.   If you're a  student, chances are that  your
  1799. university computing systems run  UNIX. With Linux,  you can run  your
  1800. own UNIX system  and tailor  it to  your own  needs.   Installing  and
  1801. running Linux is also an excellent way to learn UNIX if you don't have
  1802. access to other UNIX machines.
  1803.   But let's  not  lose sight.    Linux isn't  just  for personal  UNIX
  1804. users.  It  is robust and  complete enough to  handle large tasks,  as
  1805. well as  distributed computing  needs.   Many  businesses---especially
  1806. small  ones---are  moving  to  Linux  in  lieu  of   other  UNIX-based
  1807. 1.7.   Differences Between Linux and Other Operating Systems        24
  1808. _______________________________________________________________________
  1809.  
  1810. workstation environments.     Universities  are finding  Linux  to  be
  1811. perfect for  teaching courses  in operating  systems design.    Larger
  1812. commercial software vendors are starting to realize  the opportunities
  1813. that a free operating system can provide.
  1814.   The  following  sections   should  point  out  the  most   important
  1815. differences between Linux and other  operating systems.  We  hope that
  1816. you'll find that Linux  can meet your  computing needs, or (at  least)
  1817. enhance your current computing  environment.   Keep in mind that  they
  1818. best way to get a taste for Linux is just to try  it out---you needn't
  1819. even install a complete system  to get a feel for  it.  In  Chapter 2,
  1820. we'll show you how.
  1821.  
  1822. 1.7.2 Linux vs.  MS-DOS
  1823.  
  1824. It's not uncommon  to run both  Linux and MS-DOS  on the same  system.
  1825. Many Linux  users  rely  on  MS-DOS  for  applications  such  as  word
  1826. processing.    While  Linux  provides  its  own  analogues  for  these
  1827. applications (for  example,  TeX), there  are  various reasons  why  a
  1828. particular user would want to  run MS-DOS as well  as Linux.  If  your
  1829. entire dissertation is written using  WordPerfect for MS-DOS, you  may
  1830. not be able to easily convert it  to TeX or some other format.   There
  1831. are many commercial applications for MS-DOS which aren't available for
  1832. Linux, and there's no reason why you can't use both.
  1833.   As you might know,  MS-DOS does not fully utilize  the functionality
  1834. of the 80386  and 80486 processors.    On the other  hand, Linux  runs
  1835. completely in  the processor's  protected mode,  and  exploits all  of
  1836. the features of the processor.   You can  directly access all of  your
  1837. available memory (and  beyond, using  virtual RAM).  Linux provides  a
  1838. complete UNIX interface  not available  under MS-DOS---developing  and
  1839. porting UNIX  applications under  Linux is  easily done,  while  under
  1840. MS-DOS you  are limited  to a  small subset  of  the UNIX  programming
  1841. functionality.  Because Linux is  a true UNIX system, you do  not have
  1842. these limitations.
  1843.   We could  debate the  pros and cons  of MS-DOS  and Linux for  pages
  1844. on end.   However, let  it suffice  to say that  Linux and MS-DOS  are
  1845. completely different entities.    MS-DOS is  inexpensive (compared  to
  1846. other commercial operating systems), and has a strong foothold  in the
  1847. PC computing world.  No other operating system for the  PC has reached
  1848. the level of popularity of MS-DOS---largely because the cost  of these
  1849. other operating systems  is unapproachable  to most personal  computer
  1850. users.  Very few  PC users can imagine  spending $1000 or more on  the
  1851. operating system alone.  Linux, however, is free, and you finally have
  1852. the chance to decide.
  1853.   We will  allow you to  make your own judgments  of Linux and  MS-DOS
  1854. based on your expectations and needs.  Linux is not for everybody.  If
  1855. you have always wanted to run a complete UNIX system at  home, without
  1856. the high cost of other UNIX  implementations for the PC, Linux  may be
  1857. what you're looking for.
  1858.   There are  tools available to  allow you  to interact between  Linux
  1859. and MS-DOS. For example, it is easy to access MS-DOS files from Linux.
  1860. 1.7.   Differences Between Linux and Other Operating Systems        25
  1861. _______________________________________________________________________
  1862.  
  1863. There is also an  MS-DOS emulator available,  which allows you to  run
  1864. many popular MS-DOS  applications.   A Microsoft  Windows emulator  is
  1865. currently under development.
  1866.  
  1867. 1.7.3 Linux vs.  The Other Guys
  1868.  
  1869. A number of other  advanced operating systems are  on the rise in  the
  1870. PC world.   Specifically, IBM's  OS/2 and  Microsoft's Windows NT  are
  1871. becoming very popular as more users move away from MS-DOS.
  1872.   Both OS/2  and Windows NT are  full multitasking operating  systems,
  1873. much like Linux.  Technically,  OS/2, Windows NT, and Linux  are quite
  1874. similar:  they  support roughly  the same  features in  terms of  user
  1875. interface, networking,  security, and  so forth.    However, the  real
  1876. difference between Linux and The Other Guys is the fact  that Linux is
  1877. a version of UNIX,  and hence benefits  from the contributions of  the
  1878. UNIX community at large.
  1879.   What makes  UNIX so  important?   Not only  is it  the most  popular
  1880. operating system for multiuser machines, it is also the foundation for
  1881. the majority of the free  software world.   If you have access to  the
  1882. Internet, nearly all of the  free software available there  is written
  1883. specifically for  UNIX  systems.    (The  Internet itself  is  largely
  1884. UNIX-based.)
  1885.   There are many  implementations of UNIX,  from many vendors, and  no
  1886. single organization is responsible for distribution.  There is a large
  1887. push in the  UNIX community for  standardization in  the form of  open
  1888. systems, but no single corporation  controls this design.  Hence,  any
  1889. vendor (or, as it turns out, any hacker) may implement these standards
  1890. in an implementation of UNIX.
  1891.   OS/2 and  Windows NT, on  the other  hand, are proprietary  systems.
  1892. The interface and design are  controlled by a single corporation,  and
  1893. only that corporation may implement that design.  (Don't expect to see
  1894. a free version of  OS/2 anytime in  the near future.)   In one  sense,
  1895. this kind of organization  is beneficial:   it sets a strict  standard
  1896. for the programming and user  interface unlike that found even  in the
  1897. open systems community.  OS/2 is OS/2 wherever you go---the same holds
  1898. for Windows NT.
  1899.   However, the UNIX  interface is constantly developing  and changing.
  1900. Several organizations are  attempting to  standardize the  programming
  1901. model, but  the task  is very  difficult.   Linux,  in particular,  is
  1902. mostly compliant with  the POSIX.1 standard  for the UNIX  programming
  1903. interface.   As time  goes on,  it is  expected that  the system  will
  1904. adhere to other such standards, but standardization is not the primary
  1905. issue in the Linux development community.
  1906.  
  1907. 1.7.4 Other implementations of UNIX
  1908.  
  1909. There are  several other  implementations of  UNIX for  the 80386  and
  1910. 80486.  The 80386 architecture lends itself to the UNIX  design, and a
  1911. number of vendors have taken advantage of this.
  1912.   Feature-wise, other  implementations of  UNIX for the  PC are  quite
  1913. 1.7.   Differences Between Linux and Other Operating Systems        26
  1914. _______________________________________________________________________
  1915.  
  1916. similar to Linux.   You will see  that almost all commercial  versions
  1917. of UNIX support  roughly the same  software, programming  environment,
  1918. and networking features.   However, there are some  strong differences
  1919. between Linux and commercial versions of UNIX.
  1920.   First  of  all,  Linux  supports  a   different  range  of  hardware
  1921. from commercial  implementations.    In  general, Linux  supports  the
  1922. most well-known  hardware devices,  but support  is  still limited  to
  1923. that hardware  which developers  actually have  access to.    However,
  1924. commercial UNIX vendors generally have a wider support base,  and tend
  1925. to support more  hardware, although Linux  is not far  behind.   We'll
  1926. cover the hardware requirements for Linux in Section 1.8.
  1927.   Secondly, commercial  implementations of  UNIX usually come  bundled
  1928. with a complete set of documentation as well as user  support from the
  1929. vendor.  In contrast, most  of the documentation for Linux  is limited
  1930. to documents available on the  Internet---and books such as this  one.
  1931. In Section 1.9  we'll list  sources of Linux  documentation and  other
  1932. information.
  1933.   As far as  stability and robustness  are concerned, many users  have
  1934. reported that Linux is at least as stable as commercial  UNIX systems.
  1935. Linux is still  under development, and  certain features (such  TCP/IP
  1936. networking) are less stable but improve as time goes by.
  1937.   The most important factor to consider for many users is  price.  The
  1938. Linux software is free, if you have access to the Internet (or another
  1939. computer network) and  can download  it.   If you  do not have  access
  1940. to such a  network, you  may need  to purchase  it via  mail order  on
  1941. diskette, tape, or  CD-ROM (see Appendix  B).      Of course, you  may
  1942. copy Linux from a friend who  may already have the software,  or share
  1943. the cost of purchasing it with someone  else.  If you are  planning to
  1944. install Linux on a large number of machines, you need  only purchase a
  1945. single copy of the software---Linux  is not distributed on a  ``single
  1946. machine'' license.
  1947.   The  value  of   commercial  UNIX  implementations  should  not   be
  1948. demeaned:  along with  the price of  the software itself, one  usually
  1949. pays for documentation,  support,  and assurance  of quality.    These
  1950. are very  important  factors  for  large  institutions,  but  personal
  1951. computer users may  not require  these benefits.   In  any case,  many
  1952. businesses and universities are finding that running Linux on a lab of
  1953. inexpensive personal computers is preferrable to running  a commercial
  1954. version of UNIX  in a  lab of  workstations.   Linux  can provide  the
  1955. functionality of a  workstation on PC  hardware at  a fraction of  the
  1956. cost.
  1957.   As a  ``real-world''  example of  Linux's use  within the  computing
  1958. community,  Linux  systems  have  travelled  the  high   seas  of  the
  1959. North Pacific, managing  telecommunications and  data analysis for  an
  1960. oceanographic research  vessel.    Linux  systems  are being  used  at
  1961. research stations in Antarctica.  As a more mundane  example, perhaps,
  1962. several hospitals are using Linux to maintain patient records.   It is
  1963. proving to be as reliable and useful as other implementations of UNIX.
  1964.   There are other free or inexpensive implementations of  UNIX for the
  1965. 386 and 486.  One of the most well-known is  386BSD, an implementation
  1966. 1.8.   Hardware Requirements                                        27
  1967. _______________________________________________________________________
  1968.  
  1969. and port of BSD UNIX  for the 386.   386BSD is comparable to  Linux in
  1970. many ways, but which  one is ``better''  depends on your own  personal
  1971. needs and expectations.  The only strong distinction that  we can make
  1972. is that Linux is developed openly (where any volunteer can  aid in the
  1973. development process), while 386BSD  is developed within a closed  team
  1974. of programmers who  maintain the  system.   Because  of this,  serious
  1975. philosophical and design differences  exist between the two  projects.
  1976. The goals of  the two projects  are entirely different:   the goal  of
  1977. Linux is to develop  a complete UNIX system  from scratch (and have  a
  1978. lot of fun  in the  process), and  the goal  of 386BSD is  in part  to
  1979. modify the existing BSD code for use on the 386.
  1980.   NetBSD is  another port of  the BSD NET/2  distribution to a  number
  1981. of machines,  including the  386.   NetBSD  has a  slightly more  open
  1982. development structure, and is comparable to 386BSD in many respects.
  1983.   Another project  of note  is HURD,  an effort by  the Free  Software
  1984. Foundation to develop and distribute  a free version of UNIX  for many
  1985. platforms.  Contact the Free Software Foundation (the address is given
  1986. in Appendix E) for more information  about this project.  At  the time
  1987. of this writing, HURD is still in early stages of development.
  1988.   Other inexpensive versions of  UNIX exist as well, such  as Coherent
  1989. (available for about $99) and Minix (an academic but useful UNIX clone
  1990. upon which  early development  of Linux  was based).    Some of  these
  1991. implementations are  of mostly  academic  interest, while  others  are
  1992. full-fledged systems for real productivity.  Needless to say, however,
  1993. many personal UNIX users are moving to Linux.
  1994.  
  1995.  
  1996. 1.8 Hardware Requirements
  1997.  
  1998. Now you must be convinced  of how wonderful Linux  is, and all of  the
  1999. great things  that it  can  do for  you.    However, before  you  rush
  2000. out and install  the software, you  need to be  aware of the  hardware
  2001. requirements and limitations that Linux has.
  2002.   Keep in  mind that Linux was  developed by its  users.  This  means,
  2003. for the most part,  that the hardware which  is supported by Linux  is
  2004. only the hardware which the users and developers actually  have access
  2005. to.  As  it turns out,  most of the  popular hardware and  peripherals
  2006. for 80386/80486 systems  are supported (in  fact, Linux supports  more
  2007. hardware than some commercial implementations of UNIX).  However, some
  2008. of the more  obscure and esoteric  devices aren't supported  yet.   As
  2009. time goes on,  a  wider range  of hardware  is supported,  so if  your
  2010. favorite devices aren't listed here, chances are that support for them
  2011. is forthcoming.
  2012.   Another  drawback for  hardware  support under  Linux is  that  many
  2013. companies have  decided to  keep the  hardware interface  proprietary.
  2014. The upshot of  this is  that volunteer Linux  developers simply  can't
  2015. write drivers for those  devices (if they  could, those drivers  would
  2016. be owned by the company that owned the interface,  which would violate
  2017. the GPL).  The companies  that maintain  proprietary interfaces  write
  2018. their own drivers for operating  systems such as MS-DOS and  Microsoft
  2019. Windows; the  end user  (that's you)  never  needs to  know about  the
  2020. 1.8.   Hardware Requirements                                        28
  2021. _______________________________________________________________________
  2022.  
  2023. interface.   Unfortunately, this  does not allow  Linux developers  to
  2024. write drivers for those devices.
  2025.   There is very little that can be done about the situation.   In some
  2026. cases, programmers have  attempted to write  hackish drivers based  on
  2027. assumptions about the interface.  In other cases, developers will work
  2028. with the company in question  and attempt to obtain information  about
  2029. the device interface, with varying degrees of success.
  2030.   In the following  sections, we'll attempt to summarize  the hardware
  2031. requirements for Linux.   The Linux  Hardware HOWTO (see Section  1.9)
  2032. contains a more complete listing of hardware supported by Linux.
  2033.   Disclaimer:  a good deal of hardware support  for Linux is currently
  2034. in the development stage.   Some distributions may or may  not support
  2035. these experimental features.   This  section primarily lists  hardware
  2036. which has been  supported for  some time  and is known  to be  stable.
  2037. When in  doubt,  consult the  documentation  for the  distribution  of
  2038. Linux you are  using (see Section  2.1 for  more information on  Linux
  2039. distributions).
  2040.  
  2041. 1.8.1 Motherboard and CPU requirements
  2042.  
  2043. Linux currently  supports  systems  with an  Intel  80386,  80486,  or
  2044. Pentium CPU. This includes  all variations on  this CPU type, such  as
  2045. the 386SX, 486SX, 486DX,  and 486DX2.   Non-Intel ``clones'', such  as
  2046. AMD and Cyrix processors, work with Linux as well.
  2047.   If you  have a 80386  or 80486SX, you  may also wish  to use a  math
  2048. coprocessor, although  one isn't  required (the  Linux  kernel can  do
  2049. FPU emulation if you do  not have a math  coprocessor).  All  standard
  2050. FPU couplings are  supported, such  as IIT, Cyrix  FasMath, and  Intel
  2051. coprocessors.
  2052.   The  system motherboard  must  use  ISA or  EISA  bus  architecture.
  2053. These terms  define how  the system  interfaces  with peripherals  and
  2054. other components on the main bus.  Most systems sold  today are either
  2055. ISA or EISA bus.  IBM's MicroChannel (MCA) bus, found on machines such
  2056. as the IBM PS/2, is not currently supported.
  2057.   Systems which  use a local  bus architecture  (for faster video  and
  2058. disk access) are supported as well.   It is suggested that you  have a
  2059. standard local bus architecture such as the VESA Local Bus (``VLB'').
  2060.  
  2061. 1.8.2 Memory requirements
  2062.  
  2063. Linux requires very little  memory to run  compared to other  advanced
  2064. operating systems.  You should  have at the very least 2  megabytes of
  2065. RAM; however, it is strongly suggested that you have 4 megabytes.  The
  2066. more memory you have, the faster the system will run.
  2067.   Linux can support the  full 32-bit address range of the 386/486;  in
  2068. other words, it will utilize all of your RAM automatically.
  2069.   Linux  will run  happily with  only 4  megabytes  of RAM,  including
  2070. all of the bells  and whistles such  as X Windows,  Emacs, and so  on.
  2071. However, having more memory is almost as important as  having a faster
  2072. processor.   8 megabytes  is more  than enough  for personal  use;  16
  2073. 1.8.   Hardware Requirements                                        29
  2074. _______________________________________________________________________
  2075.  
  2076. megabytes or more may be needed if you are expecting a heavy user load
  2077. on the system.
  2078.   Most Linux  users allocate  a portion  of their hard  drive as  swap
  2079. space, which is  used as virtual RAM.  Even if you  have a great  deal
  2080. of physical  RAM in  your machine,  you may  wish to  use swap  space.
  2081. While swap space  is no replacement  for actual  physical RAM, it  can
  2082. allow your system to run larger applications by swapping  out inactive
  2083. portions of code to disk.   The amount  of swap space that you  should
  2084. allocate depends on several factors; we'll come back to  this question
  2085. in Section 2.2.3.
  2086.  
  2087. 1.8.3 Hard drive controller requirements
  2088.  
  2089. You do not  need to  have a hard  drive to  run Linux;  you can run  a
  2090. minimal system completely  from floppy.    However, this  is slow  and
  2091. very limited, and many users have access to hard drive storage anyway.
  2092. You must have an  AT-standard (16-bit) controller.   There is  support
  2093. in the  kernel for  XT-standard  (8 bit)  controllers;  however,  most
  2094. controllers used today are AT-standard.  Linux should support all MFM,
  2095. RLL, and IDE  controllers.   Most, but not  all, ESDI controllers  are
  2096. supported---only those which do ST506 hardware emulation.
  2097.   The general rule for  non-SCSI hard drive and floppy  controllers is
  2098. that if you  can access  the drive  from MS-DOS  or another  operating
  2099. system, you should be able to access it from Linux.
  2100.   Linux also  supports  a number  of popular  SCSI drive  controllers,
  2101. although support for SCSI  is more limited  because of the wide  range
  2102. of controller interface standards.  Supported SCSI controllers include
  2103. the Adaptec AHA1542B, AHA1542C, AHA1742A (BIOS version 1.34), AHA1522,
  2104. AHA1740, AHA1740  (SCSI-2 controller,  BIOS  1.34 in  Enhanced  mode);
  2105. Future Domain 1680, TMC-850,  TMC-950; Seagate ST-02; UltraStor  SCSI;
  2106. Western Digital WD7000FASST.  Clones which  are based  on these  cards
  2107. should work as well.
  2108.  
  2109. 1.8.4 Hard drive space requirements
  2110.  
  2111. Of course, to install Linux, you'll  need to have some amount  of free
  2112. space on your hard drive.  Linux will support multiple  hard drives in
  2113. the same machine;  you can  allocate space  for Linux across  multiple
  2114. drives if necessary.
  2115.   The  amount of  hard  drive  space  that you  will  require  depends
  2116. greatly  on  your  needs  and  the  amount  of  software  that  you're
  2117. installing.  Linux is relatively small as UNIX implementations go; you
  2118. could run a complete  system in 10  to 20 megabytes  of space on  your
  2119. drive.   However, if  you want  to have  room for  expansion, and  for
  2120. larger packages such as X Windows, you  will need more space.   If you
  2121. plan to allow  multiple users  to use the  machine, you  will need  to
  2122. allocate storage for their files.
  2123.   Also, unless you have  a large amount of physical RAM  (16 megabytes
  2124. or more), you will more than likely want to allocate swap space, to be
  2125. used as virtual RAM. We will discuss all of the  details of installing
  2126. 1.8.   Hardware Requirements                                        30
  2127. _______________________________________________________________________
  2128.  
  2129. and using swap space in Section 2.2.3.
  2130.   Each distribution of  Linux usually comes with some  literature that
  2131. should help  you  to gauge  the  precise  amount of  required  storage
  2132. depending on the  amount of  software you plan  to install.   You  can
  2133. run a minimal system  with less than 20  megabytes; a complete  system
  2134. with all  of the  bells and  whistles  in 80  megabytes or  less;  and
  2135. a very large  system with  room for  many users and  space for  future
  2136. expansion in the  range of 100-150  megabytes.   Again, these  figures
  2137. are meant only as a ballpark  approximation; you will have to  look at
  2138. your own needs and goals  in order to determine your  specific storage
  2139. requirements.
  2140.  
  2141. 1.8.5 Monitor and video adapator requirements
  2142.  
  2143. Linux supports all standard Hercules,  CGA, EGA, VGA, IBM  monochrome,
  2144. and Super  VGA video  cards and  monitors for  the default  text-based
  2145. interface.  In general, if  the video card and monitor  coupling works
  2146. under another operating  system such  as MS-DOS, it  should work  fine
  2147. with Linux.  Original IBM CGA cards suffer from  ``snow'' under Linux,
  2148. which is not pleasant to use.
  2149.   Graphical  environments such  as  the  X Window  System  have  video
  2150. hardware requirements  of  their  own.     Instead  of  listing  these
  2151. requirements here, we relegate  the discussion to  Section 5.1.1.   In
  2152. short, to run the X Window System on your Linux machine, you will need
  2153. one of the video cards listed in that section.
  2154.  
  2155. 1.8.6 Miscellaneous hardware
  2156.  
  2157. The above sections  described the  hardware which is  required to  run
  2158. a Linux system.   However,  most users have  a number of  ``optional''
  2159. devices such as tape and CD-ROM storage, sound boards, and  so on, and
  2160. are interested in whether or not this hardware is supported  by Linux.
  2161. Read on.
  2162.  
  2163. 1.8.6.1 Mice and other pointing devices
  2164.  
  2165. For the most part,  you will only be  using a mouse under a  graphical
  2166. environment such  as the  X Window  System.   However,  several  Linux
  2167. applications not associated with a graphics environment do make use of
  2168. the mouse.
  2169.   Linux supports  all  standard serial  mice, including  Logitech,  MM
  2170. series, Mouseman, Microsoft  (2-button) and Mouse Systems  (3-button).
  2171. Linux also supports Microsoft, Logitech, and ATIXL busmice.   The PS/2
  2172. mouse interface is supported as well.
  2173.   All other  pointing devices, such as  trackballs, which emulate  the
  2174. above mice, should work as well.
  2175. 1.8.   Hardware Requirements                                        31
  2176. _______________________________________________________________________
  2177.  
  2178. 1.8.6.2 CD-ROM storage
  2179.  
  2180. Almost all CD-ROM drives use the SCSI interface.  As long  as you have
  2181. a SCSI adaptor supported by Linux, then your CD-ROM drive should work.
  2182. A number of  CD-ROM drives  have been  verified to  work under  Linux,
  2183. including the NEC CDR-74, Sony CDU-541,  and Texel DM-3024.   The Sony
  2184. internal CDU-31a and the Mistsumi CD-ROM drives are supported by Linux
  2185. as well.
  2186.   Linux supports the standard ISO-9660 filesystem for CD-ROMs.
  2187.  
  2188. 1.8.6.3 Tape drives
  2189.  
  2190. There are several types of tape drives available on the market.   Most
  2191. of them use the  SCSI interface, all of  which should be supported  by
  2192. Linux.  Among  the verified SCSI tape  drives are the Sankyo  CP150SE;
  2193. Tandberg 3600;  Wangtek  5525ES,  5150ES,  and 5099EN  with  the  PC36
  2194. adaptor.  Other QIC-02 drives should be supported as well.
  2195.   Drivers  are currently  under  development  for various  other  tape
  2196. devices,  such  as Colorado  drives  which  hang  off  of  the  floppy
  2197. controller.
  2198.  
  2199. 1.8.6.4 Printers
  2200.  
  2201. Linux supports the complete  range of parallel printers.   If you  are
  2202. able to  access your  printer via  the parallel  port  from MS-DOS  or
  2203. another operating system, you should  be able to access it  from Linux
  2204. as well.  The Linux printing software consists of the UNIX standard lp
  2205. and lpr software.  This software also allows you to print remotely via
  2206. the network, if you have one available.
  2207.  
  2208. 1.8.6.5 Modems
  2209.  
  2210. As with  printer support,  Linux  supports the  full  range of  serial
  2211. modems, both  internal  and  external.    There  is a  great  deal  of
  2212. telecommunications software  available  for Linux,  including  Kermit,
  2213. pcomm, minicom, and Seyon.   If your modem is accessible  from another
  2214. operating system on the same machine, you should be able  to access it
  2215. from Linux with no difficulty.
  2216.  
  2217. 1.8.7 Ethernet cards
  2218.  
  2219. Many popular Ethernet cards and  LAN adaptors are supported by  Linux.
  2220. These include:
  2221.  
  2222.  o  3com 3c503, 3c503/16
  2223.  
  2224.  o  Novell NE1000, NE2000
  2225.  
  2226.  o  Western Digital WD8003, WD8013
  2227. 1.9.   Sources of Linux Information                                 32
  2228. _______________________________________________________________________
  2229.  
  2230.  o  Hewlett Packard HP27245, HP27247, HP27250
  2231.  
  2232.  o  D-Link DE-600
  2233.  
  2234. The following clones are reported to work:
  2235.  
  2236.  o  LANNET LEC-45
  2237.  
  2238.  o  Alta Combo
  2239.  
  2240.  o  Artisoft LANtastic AE-2
  2241.  
  2242.  o  Asante Etherpak 2001/2003,
  2243.  
  2244.  o  D-Link Ethernet II
  2245.  
  2246.  o  LTC E-NET/16 P/N 8300-200-002
  2247.  
  2248.  o  Network Solutions HE-203,
  2249.  
  2250.  o  SVEC 4 Dimension Ethernet
  2251.  
  2252.  o  4-Dimension FD0490 EtherBoard 16
  2253.  
  2254. Clones which are compatible with any of the above cards should work as
  2255. well.
  2256.  
  2257.  
  2258. 1.9 Sources of Linux Information
  2259.  
  2260. As you have probably  guessed, there are  many sources of  information
  2261. about Linux available  apart from  this book.    In particular,  there
  2262. are a number  of books, not  specific to Linux  but rather about  UNIX
  2263. in general, that will  be of importance,  especially to those  readers
  2264. without previous UNIX experience.   If you are new to the  UNIX world,
  2265. we seriously suggest  that you take  the time to  peruse one of  these
  2266. books before you attempt to brave the jungles of Linux.  Specifically,
  2267. the book Learning the UNIX Operating System, by Grace  Todino and John
  2268. Strang, is a good place to start.
  2269.   Many of  the following sources of  information are available  online
  2270. in some electronic form.  That  is, you must have access to  an online
  2271. network, such as the Internet, USENET, or Fidonet, in  order to access
  2272. the information contained therein.   If you do not have  online access
  2273. to any of this material, you might be able to find someone kind enough
  2274. to give you hardcopies of the documents in question.  Read on.
  2275.  
  2276. 1.9.1 Online documents
  2277.  
  2278. If you have  access to the  Internet, there  are many Linux  documents
  2279. available via anonymous FTP from archive sites all over the world.  If
  2280. 1.9.   Sources of Linux Information                                 33
  2281. _______________________________________________________________________
  2282.  
  2283. you do not have direct Internet  access, these documents may  still be
  2284. available to you:  many  Linux distributions on CD-ROM contain  all of
  2285. the documents mentioned  here.   Also,  they are  distributed on  many
  2286. other networks, such as  Fidonet and CompuServe.   If you are able  to
  2287. send mail to Internet sites, you  may be able to retrieve  these files
  2288. using one of the  ftpmail servers which  will electronically mail  you
  2289. the documents or files  from FTP archive  sites.   See Appendix C  for
  2290. more information on using ftpmail.
  2291.   There is  a  great number  of FTP  archive sites  which carry  Linux
  2292. software and related documents.   A  list of well-known Linux  archive
  2293. sites is given in Appendix C.  In order to reduce network traffic, you
  2294. should always use the FTP site which is  geographically (network-wise)
  2295. closest to you.
  2296.   Appendix A contains a  listing of some of the Linux  documents which
  2297. are available via anonymous FTP.  The filenames will differ  depending
  2298. on the  archive  site  in  question;  most  sites  keep  Linux-related
  2299. documents in the docs subdirectory of their Linux archive space.   For
  2300. example, on the FTP  site sunsite.unc.edu, Linux  files are stored  in
  2301. the directory /pub/Linux, with Linux-related documentation being found
  2302. in /pub/Linux/docs.
  2303.   Examples  of  available  online  documents  are  the  Linux  FAQ,  a
  2304. collection of frequently asked questions about Linux; the  Linux HOWTO
  2305. documents, each describing a specific aspect of the system---including
  2306. the Installation HOWTO,  the Printing HOWTO,  and the Ethernet  HOWTO;
  2307. and, the Linux META-FAQ, a list of other sources  of Linux information
  2308. on the Internet.
  2309.   Most of  these documents are  also regularly posted  to one or  more
  2310. Linux-related USENET newsgroups; see Section 1.9.4 below.
  2311.  
  2312. 1.9.2 Linux on the World Wide Web
  2313.  
  2314. The Linux  Documentation Home  Page is  available for  World Wide  Web
  2315. users at the URL
  2316.  
  2317.     http://sunsite.unc.edu/mdw/linux.html
  2318.  
  2319. This page contains many HOWTOs and other documents in HTML  format, as
  2320. well as pointers to other sites of interest to Linux users.
  2321.  
  2322. 1.9.3 Books and other published works
  2323.  
  2324. At this time, there are few published works specifically  about Linux.
  2325. Most noteworthy are  the books from  the Linux Documentation  Project,
  2326. a project carried  out over  the Internet  to write  and distribute  a
  2327. bona fide set of ``manuals'' for  Linux.  These manuals  are analogues
  2328. to the documentation sets available with commercial versions  of UNIX:
  2329. they cover everything from installing Linux, to using and  running the
  2330. system, programming, networking, kernel development, and more.
  2331.   The Linux Documentation Project manuals are  available via anonymous
  2332. FTP from the Internet, as well as via mail order from several sources.
  2333. 1.9.   Sources of Linux Information                                 34
  2334. _______________________________________________________________________
  2335.  
  2336. Appendix A lists the manuals  which are available and covers  means of
  2337. obtaining them in detail.
  2338.   There  are  not  many  books  specifically   about  Linux  currently
  2339. available.  However, there are  a large number of books about  UNIX in
  2340. general which are certainly applicable to Linux---as far as  using and
  2341. programming the system  is concerned,  Linux does  not differ  greatly
  2342. from other implementations  of UNIX. In  short, almost everything  you
  2343. want to know about using and programming Linux can be found in sources
  2344. meant for a general UNIX audience.  In fact, this book is  meant to be
  2345. complemented by the large library  of UNIX books currently  available;
  2346. here, we present  the most important  Linux-specific details and  hope
  2347. that you will look to other sources for more in-depth information.
  2348.   Armed with  a number  of good  books about  using UNIX,  as well  as
  2349. the book you hold  in your hands,  you should be  able to tackle  just
  2350. about anything.  Appendix A includes a list of highly-recommended UNIX
  2351. books, both for UNIX newcomers and UNIX wizards alike.
  2352.   There is  also  a monthly  magazine about  Linux,  called the  Linux
  2353. Journal.  It is distributed worldwide, and is an excellent way to keep
  2354. in touch with the many  goings-on in the Linux  community---especially
  2355. if you do not have access to USENET news (see below).   See Appendix A
  2356. for information on subscribing to the Linux Journal.
  2357.  
  2358. 1.9.4 USENET newsgroups
  2359.  
  2360. USENET is  a  worldwide  electronic  news and  discussion  forum  with
  2361. a heavy  contingent  of  so-called  ``newsgroups''---discussion  areas
  2362. devoted to  a particular  topic.   Much  of the  development of  Linux
  2363. has been  done over  the waves  of the  Internet and  USENET, and  not
  2364. suprisingly there  are a  number of  USENET  newsgroups available  for
  2365. discussions about Linux.
  2366.   The original  Linux newsgroup was alt.os.linux,  and was created  to
  2367. move some of the discussions about Linux out of comp.os.minix  and the
  2368. various mailing lists.  Soon,  the traffic on alt.os.linux grew  to be
  2369. large enough that a newsgroup in  the comp hierarchy was warranted;  a
  2370. vote was taken in February of 1992, and comp.os.linux was created.
  2371.   comp.os.linux quickly became  one of the most popular  (and loudest)
  2372. USENET groups; more popular than any other comp.os group.  In December
  2373. of 1992, a vote  was taken to split  the newsgroup in order to  reduce
  2374. traffic; only  comp.os.linux.announce passed this  vote.   In July  of
  2375. 1993, the group was finally split into the new hierarchy.  Almost 2000
  2376. people voted in the comp.os.linux reorganization, making it one of the
  2377. largest USENET Call For Votes ever.
  2378.   If you  do  not have  direct USENET  access,  but are  able to  send
  2379. and receive electronic mail from the Internet, there  are mail-to-news
  2380. gateways available for each of the newsgroups below.
  2381.  
  2382. comp.os.linux.announce
  2383.            comp.os.linux.announce   is  a   moderated  newsgroup   for
  2384.            announcements  and  important  postings   about  the  Linux
  2385.            system   (such  as  bug  reports,   important  patches   to
  2386. 1.9.   Sources of Linux Information                                 35
  2387. _______________________________________________________________________
  2388.  
  2389.            software,  and so on).   If you  read any Linux  newsgroups
  2390.            at all,  read this one.   Often, the important  postings in
  2391.            this  group are  not crossposted  to  other groups.    This
  2392.            group  also contains  many periodic  postings about  Linux,
  2393.            including  many of  the online documents  described in  the
  2394.            last section and listed in Appendix A.
  2395.  
  2396.            Postings  to  this  newsgroup  must   be  approved  by  the
  2397.            moderators,  Matt Welsh and  Lars Wirzenius.   If you  wish
  2398.            to  submit  and  article  to  this  group,  in  most  cases
  2399.            you  can simply  post  the article  as you  normally  would
  2400.            (using  Pnews or  whatever posting software  that you  have
  2401.            available);  the news  software will automatically  forward
  2402.            the article  to the moderators for  approval.  However,  if
  2403.            your  news system  is not set  up correctly,  you may  need
  2404.            to  mail the article  directly; the  submission address  is
  2405.            linux-announce@tc.cornell.edu.
  2406.            The  rest   of  the  Linux  newsgroups  listed   below  are
  2407.            unmoderated.
  2408.  
  2409. comp.os.linux.help
  2410.            This  is  the  most  popular  Linux   newsgroup.     It  is
  2411.            for  questions  and answers  about using,  setting  up,  or
  2412.            otherwise  running  a Linux  system.    If you  are  having
  2413.            problems with  Linux, you may  post to this newsgroup,  and
  2414.            hopefully receive  a reply from  someone who might be  able
  2415.            to help.   However, it is strongly suggested that  you read
  2416.            all  of the  available Linux  documentation before  posting
  2417.            questions to this newsgroup.
  2418.  
  2419. comp.os.linux.admin
  2420.            This  newsgroup  is  for  questions  and  discussion  about
  2421.            running a Linux system, most commonly  in an active, multi-
  2422.            user  environment.    Any discussion  about  administrative
  2423.            issues  of  Linux  (such  as  packaging  software,   making
  2424.            backups, handling users, and so on) is welcome here.
  2425.  
  2426. comp.os.linux.development
  2427.            This  is a newsgroup for  discussions about development  of
  2428.            the  Linux  system.    All  issues related  to  kernel  and
  2429.            system software development should be discussed  here.  For
  2430.            example, if  you are writing a kernel driver and  need help
  2431.            with certain aspects of the programming,  this would be the
  2432.            place  to ask.    This  newsgroup is  also for  discussions
  2433.            about the direction and goals  behind the Linux development
  2434.            effort, as described (somewhat) in Section 1.6.
  2435.            It   should   be  noted   that   this  newsgroup   is   not
  2436.            (technically)   for   discussions  about   development   of
  2437.            software   for  Linux,  but   rather  for  discussions   of
  2438.            development  of  Linux.    That  is,  issues  dealing  with
  2439. 1.9.   Sources of Linux Information                                 36
  2440. _______________________________________________________________________
  2441.  
  2442.            applications  programming under Linux  should be  discussed
  2443.            in  another Linux  newsgroup; comp.os.linux.development  is
  2444.            about  developing the  Linux system  itself, including  the
  2445.            kernel, system libraries, and so on.
  2446.  
  2447. comp.os.linux.misc
  2448.            This  newsgroup is for all  discussion which doesn't  quite
  2449.            fit into the other available Linux  groups.  In particular,
  2450.            advocacy  wars (the incessant  ``Linux versus Windows  NT''
  2451.            thread,  for example),  should  be waged  here, as  opposed
  2452.            to  in the  technical Linux groups.    Any nontechnical  or
  2453.            metadiscourse  about  the  Linux system  should  remain  in
  2454.            comp.os.linux.misc.
  2455.  
  2456.   It  should be  noted that  the  newsgroup comp.os.linux,  which  was
  2457. originally the  only  Linux group,  has  been  superseded by  the  new
  2458. hierarchy of groups.  If you have access to comp.os.linux,  but not to
  2459. the newer Linux groups listed above, encourage your news administrator
  2460. to create the new groups on your system.
  2461.  
  2462. 1.9.5 Internet mailing lists
  2463.  
  2464. If you have access  to Internet electronic  mail, you can  participate
  2465. in a number of mailing  lists even if you  do not have USENET  access.
  2466. Note that if you are  not directly on the  Internet, you can join  one
  2467. of these mailing lists as long as you are able  to exchange electronic
  2468. mail with the  Internet (for example,  UUCP, FidoNET, CompuServe,  and
  2469. other networks all have access to Internet mail).
  2470.   The  ``Linux  Activists''  mailing  list  is   primarily  for  Linux
  2471. developers and people  interested in  aiding the development  process.
  2472. This is a  ``multi-channel'' mailing list,  in which  you join one  or
  2473. more ``channels'' based  on your particular  interests.   Some of  the
  2474. available channels include:  NORMAL, for general Linux-related issues;
  2475. KERNEL, for kernel development;  GCC, for discussions relating to  the
  2476. gcc compiler and library development;  NET, for discussions about  the
  2477. TCP/IP networking  code;  DOC,  for  issues relating  to  writing  and
  2478. distributing Linux documentation; and more.
  2479.   For more  information about the Linux  Activists mailing list,  send
  2480. mail to
  2481.  
  2482.     linux-activists@niksula.hut.fi
  2483.  
  2484. You will receive  a list  of currently  available channels,  including
  2485. information on how to subscribe and unsubscribe to particular channels
  2486. on the list.
  2487.   Quite a few special-purpose mailing lists about and  for Linux exist
  2488. as well.  The best way to  find out about these is to watch  the Linux
  2489. USENET newsgroups for announcements,  as well as  to read the list  of
  2490. publicly-available mailing lists,  periodically posted  to the  USENET
  2491. group news.answers.
  2492. 1.10.   Getting Help                                                37
  2493. _______________________________________________________________________
  2494.  
  2495. 1.10 Getting Help
  2496.  
  2497. You will undoubtedly  require some  degree of  assistance during  your
  2498. adventures in the Linux world.  Even the most wizardly of UNIX wizards
  2499. occasionally is stumped by  some quirk or  feature of Linux, and  it's
  2500. important to know how and where to find help when you need it.
  2501.   The  primary means  of  getting help  in  the  Linux world  are  via
  2502. Internet  mailing  lists  and  USENET  newsgroups,  as   discussed  in
  2503. Section 1.9.  If  you don't have online  access to these sources,  you
  2504. might be  able to  find comparable  Linux discussion  forums on  other
  2505. online services, such as on local BBS's, CompuServe, and so on.
  2506.   A number of  businesses are providing commercial support  for Linux.
  2507. This will allow you to pay a ``subscription fee'' which will allow you
  2508. to call the consultants for help with your Linux problems.  Appendix B
  2509. contains a list  of Linux  vendors, some of  which provide  commercial
  2510. support.  However, if you have access to USENET and Internet mail, you
  2511. may find the free support found there to be just as useful.
  2512.   Keeping the following suggestions in mind will  greatly improve your
  2513. experiences with Linux and will guarantee you more success  in finding
  2514. help to your problems.
  2515.   Consult all available  documentation...first!   The first  thing you
  2516. should do when encountering a  problem is consult the various  sources
  2517. of information listed in Section 1.9 and Appendix A.   These documents
  2518. were laboriously written  for people like  you---people who need  help
  2519. with the Linux system.   Even  books written for  UNIX in general  are
  2520. applicable to Linux, and you should take advantage of them.  More than
  2521. likely, you will find  the answer to  your problems somewhere in  this
  2522. documentation, as impossible as it may seem.
  2523.   If  you have  access to  USENET  news or  any of  the  Linux-related
  2524. mailing lists, be sure to  actually read the information  there before
  2525. posting for help with your problem.   Many times, solutions  to common
  2526. problems are  not  easy to  find  in documentation,  and  instead  are
  2527. well-covered in the newsgroups and mailing lists devoted to Linux.  If
  2528. you only post to these groups,  and don't actually read them,  you are
  2529. asking for trouble.
  2530.   Learn  to  appreciate  self-maintenance.    In  most  cases,  it  is
  2531. preferable to do as much  independent research and investigation  into
  2532. the problem as possible before seeking  outside help.  After all,  you
  2533. asked for it,  by running  Linux in the  first place!   Remember  that
  2534. Linux is all about hacking  and fixing problems yourself.   It is  not
  2535. a commercial  operating system,  nor does  it  try to  look like  one.
  2536. Hacking won't kill you.  In fact, it will teach you a great deal about
  2537. the system  to investigate  and solve  problems yourself---maybe  even
  2538. enough to one day call yourself a Linux guru.  Learn to appreciate the
  2539. value of hacking the system,  and how to  fix problems yourself.   You
  2540. can't expect to  run a  complete, homebrew Linux  system without  some
  2541. degree of handiwork.
  2542.   Remain calm.   It is vital  to refrain from getting frustrated  with
  2543. the system, at  all costs.   Nothing is earned  by taking an  axe---or
  2544. worse, a powerful  electromagnet---to your  Linux system in  a fit  of
  2545. 1.10.   Getting Help                                                38
  2546. _______________________________________________________________________
  2547.  
  2548. anger.  The authors  have found that a  large punching bag or  similar
  2549. inanimate object is a wonderful  way to relieve the occasional  stress
  2550. attack.  As Linux matures  and distributions become more reliable,  we
  2551. hope that this problem  will go away.   However, even commercial  UNIX
  2552. implementations can be  tricky at  times.   When all  else fails,  sit
  2553. back, take a few deep breaths, and go after the problem again when you
  2554. feel relaxed.  Your mind and conscience will be clearer.
  2555.   Refrain  from posting  spuriously.   Many  people  make the  mistake
  2556. of posting or mailing  messages pleading for  help prematurely.   When
  2557. encountering a problem, do not---we repeat, do  not---rush immediately
  2558. to your  nearest terminal  and  post a  message to  one  of the  Linux
  2559. USENET newsgroups.    Often,  you  will catch  your own  mistake  five
  2560. minutes later and find yourself in the curious situation  of defending
  2561. your own sanity in  a public forum.   Before  posting anything any  of
  2562. the Linux mailing lists  or newsgroups, first  attempt to resolve  the
  2563. problem yourself and be absolutely certain what the problem is.   Does
  2564. your system not  respond when  switched on?   Perhaps  the machine  is
  2565. unplugged.
  2566.   If you do  post for help,  make it worthwhile.   If all else  fails,
  2567. you may  wish to  post a  message for  help in  any of  the number  of
  2568. electronic forums dedicated  to Linux, such  as USENET newsgroups  and
  2569. mailing lists.   When posting, remember  that the people reading  your
  2570. post are not  there to help  you.   The network  is not your  personal
  2571. consulting service.  Therefore,  it is important to remain  as polite,
  2572. terse, and informative as possible.
  2573.   How can  one accomplish this?    First, you  should include as  much
  2574. (relevant) information about your system and your problem as possible.
  2575. Posting the simple request,  ``I cannot seem  to get e-mail to  work''
  2576. will probably get you nowhere  unless you include information on  your
  2577. system, what software you are using, what you have attempted  to do so
  2578. far and what the results were.  When including  technical information,
  2579. it is  usually a  good  idea to  include  general information  on  the
  2580. version(s) of your  software (Linux kernel  version, for example),  as
  2581. well as a  brief summary  of your  hardware configuration.    However,
  2582. don't overdo  it---including  information on  the  brand and  type  of
  2583. monitor that  you have  probably  is irrelevant  if you're  trying  to
  2584. configure networking software.
  2585.   Secondly,  remember that  you need  to  make some  attempt---however
  2586. feeble---at solving your problem  before you go  to the Net.   If  you
  2587. have never attempted  to set  up electronic  mail,  for instance,  and
  2588. first decide to ask folks on the Net how to go about doing it, you are
  2589. making a big mistake.  There are a number of  documents available (see
  2590. the Section 1.9) on  how to get started  with many common tasks  under
  2591. Linux.  The idea  is to get as far  along as possible on your  own and
  2592. then ask for help if and when you get stuck.
  2593.   Also  remember  that  the  people  reading  your  message,   however
  2594. helpful, may occasionally  get frustrated by  seeing the same  problem
  2595. over and over again.   Be sure to  actually read the Linux  newsgroups
  2596. and mailing  lists before  posting your  problems.   Many  times,  the
  2597. solution to your problem has been discussed repeatedly, and all that's
  2598. 1.10.   Getting Help                                                39
  2599. _______________________________________________________________________
  2600.  
  2601. required to find it is to browse the current messages.
  2602.   Lastly,  when posting to  electronic newsgroups  and mailing  lists,
  2603. try to  be  as  polite  as  possible.    It  is  much  more  effective
  2604. and worthwhile to  be polite,  direct,  and informative---more  people
  2605. will be willing  to help  you if  you master  a humble  tone.   To  be
  2606. sure, the flame  war is an  art form across  many forms of  electronic
  2607. communication, but  don't  allow  that  to preoccupy  your  and  other
  2608. people's time.    Save  the network  undue wear  and  tear by  keeping
  2609. bandwidth as low as possible, and by paying as much attention to other
  2610. sources of information  which are available  to you.   The network  is
  2611. an excellent way  to get  help with  your Linux  problems---but it  is
  2612. important to know how to use the network effectively.
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621. Chapter 2
  2622.  
  2623.  
  2624.  
  2625.  
  2626. Obtaining and Installing Linux
  2627.  
  2628.  
  2629.  
  2630. In this chapter, we'll describe  how to obtain the Linux software,  in
  2631. the form of one of the various pre-packaged distributions,  and how to
  2632. install the distribution that you choose.
  2633.   As we have  mentioned, there is no single  ``official'' distribution
  2634. of the Linux software;  there are, in  fact, many distributions,  each
  2635. of which  serves  a  particular purpose  and  set  of goals.     These
  2636. distributions are available  via anonymous FTP  from the Internet,  on
  2637. BBS systems worldwide, and via mail on diskette, tape, and CD-ROM.
  2638.   Here, we  present a  general overview of  the installation  process.
  2639. Each distribution has its own specific installation  instructions, but
  2640. armed with the concepts presented here you should be able to feel your
  2641. way through any installation.  Appendix A lists sources of information
  2642. for installation instructions  and other  help, if you're  at a  total
  2643. loss.
  2644.   This  book  contains additional  sections  detailing  the  Slackware
  2645. distribution of Linux.
  2646.  
  2647. 2.1 Distributions of Linux
  2648.  
  2649. Because Linux is free  software, no single  organization or entity  is
  2650. responsible for releasing and distributing  the software.   Therefore,
  2651. anyone is free to put together  and distribute the Linux software,  as
  2652. long as the restrictions in the GPL are observed.  The  upshot of this
  2653. is that there are many distributions of Linux, available via anonymous
  2654. FTP or via mail order.
  2655.   You  are now  faced with  the  task of  deciding upon  a  particular
  2656. distribution of Linux which suits  your needs.  Not  all distributions
  2657. are alike.   Many of  them come with  just about  all of the  software
  2658. you'd need to  run a  complete system---and  then some.   Other  Linux
  2659. distributions are ``small'' distributions  intended for users  without
  2660. copious amounts of  diskspace.   Many distributions  contain only  the
  2661. core Linux software, and you  are expected to install  larger software
  2662. packages, such as the X Window System, yourself.  (In  Chapter 4 we'll
  2663. show you how.)
  2664.   The  Linux Distribution  HOWTO  (see  Appendix A)  contains  a  list
  2665.  
  2666.  
  2667.                                   40
  2668. 2.1.   Distributions of Linux                                       41
  2669. _______________________________________________________________________
  2670.  
  2671. of Linux  distributions available  via the  Internet as  well as  mail
  2672. order.   Appendix  B  also lists  contact addresses  for  a number  of
  2673. Linux mail-order vendors.  If  you purchased this book in  printed the
  2674. form, the publisher should  also be able to  provide you with a  Linux
  2675. distribution or tell you who can.
  2676.   How  can you  decide  among all  of these  distributions?    If  you
  2677. have access to USENET news,  or another computer conferencing  system,
  2678. you might want  to ask  there for  personal opinions  from people  who
  2679. have installed  Linux.   Even  better,  if you  know  someone who  has
  2680. installed Linux,  ask  them for  help  and advice.    There  are  many
  2681. factors to consider when choosing a distribution,  however, everyone's
  2682. needs and opinions are different.   In actuality, most of  the popular
  2683. Linux distributions contain roughly the  same set of software,  so the
  2684. distribution that you select is more or less arbitrary.
  2685.   This book contains  information on installing the popular  Slackware
  2686. and Slackware Pro distributions of Linux.
  2687.  
  2688. 2.1.1 Getting Linux from the Internet
  2689.  
  2690. If you have access to the Internet, the easiest way to obtain Linux is
  2691. via anonymous FTP.(1) Appendix C  lists a number of FTP  archive sites
  2692. which carry Linux software.  One of these is sunsite.unc.edu,  and the
  2693. various Linux distributions can be found in the directory
  2694.  
  2695.     /pub/Linux/distributions
  2696.  
  2697. there.
  2698.   Many  distributions are  released  via anonymous  FTP  as a  set  of
  2699. disk images.     That  is,  the  distribution consists  of  a  set  of
  2700. files, and  each file  contains the  binary image  of  a floppy.    In
  2701. order to copy  the contents  of the image  file onto  the floppy,  you
  2702. can use the  RAWRITE.EXE program  under MS-DOS.  This program  copies,
  2703. block-for-block, the contents of  a file to  a floppy, without  regard
  2704. for disk format.(2)
  2705.   RAWRITE.EXE is available  on the various Linux FTP sites,  including
  2706. sunsite.unc.edu in the directory
  2707.  
  2708.     /pub/Linux/system/Install/rawwrite
  2709.  
  2710. ----------------------------
  2711.  1. If you do  not have direct Internet  access, you can obtain  Linux
  2712. via the  ftpmail  service,  provided  that  you have  the  ability  to
  2713. exchange e-mail with the Internet.  See Appendix C for details.
  2714.  2. If you have access to a UNIX workstation with a  floppy drive, you
  2715. can also use the  dd command to  copy the file  image directly to  the
  2716. floppy.   A command  such as  ``dd of=/dev/rfd0  if=foo bs=18k''  will
  2717. ``raw write'' the contents of the  file foo to the floppy device  on a
  2718. Sun workstation.  Consult  your local UNIX gurus for  more information
  2719. on your system's floppy devices and the use of dd.
  2720. 2.1.   Distributions of Linux                                       42
  2721. _______________________________________________________________________
  2722.  
  2723.   Therefore, in  many cases, you simply  download the set of  diskette
  2724. images, and use RAWRITE.EXE  with each image in  turn to create a  set
  2725. of diskettes.    You boot  from the  so-called  ``boot diskette''  and
  2726. you're ready to roll.  The software is usually installed directly from
  2727. the floppies, although  some distributions allow  you to install  from
  2728. an MS-DOS partition  on your  hard drive.    Some distributions  allow
  2729. you to install  over a  TCP/IP network.   The  documentation for  each
  2730. distribution should describe  these installation  methods if they  are
  2731. available.
  2732.   Other Linux distributions are installed from a set  of MS-DOS format
  2733. floppies.  For example,  the Slackware distribution of  Linux requires
  2734. only the boot and root diskettes to be created using  RAWRITE.EXE. The
  2735. rest of the diskettes are copied to MS-DOS format diskettes  using the
  2736. MS-DOS COPY command.   The system installs the software  directly from
  2737. the MS-DOS floppies.    This saves you  the trouble  of having to  use
  2738. RAWRITE.EXE for many  image files,  although it requires  you to  have
  2739. access to an MS-DOS system to create the diskettes.
  2740.   Each  distribution  of Linux  available  via  anonymous  FTP  should
  2741. include a  README file  describing  how to  download and  prepare  the
  2742. diskettes for installation.    Be sure  to read all  of the  available
  2743. documentation for the release that you are using.
  2744.   When downloading  the Linux  software, be  sure to  use binary  mode
  2745. for all file transfers (with most FTP clients, the  command ``binary''
  2746. enables this mode).
  2747.   See  Section  2.1.4,   below,  for  information  on   obtaining  the
  2748. Slackware distribution from the Internet.
  2749.  
  2750. 2.1.2 Getting Linux from other online sources
  2751.  
  2752. If you  have access  to another  computer network  such as  CompuServe
  2753. or Prodigy,  there  may be  a  means to  download the  Linux  software
  2754. from these sources.   In addition,  many bulletin board (BBS)  systems
  2755. carry Linux  software.    A  list  of  Linux  BBS sites  is  given  in
  2756. Appendix D.   Not  all Linux  distributions are  available from  these
  2757. computer networks,  however---many  of them,  especially  the  various
  2758. CD-ROM distributions, are only available via mail order.
  2759.  
  2760. 2.1.3 Getting Linux via mail order
  2761.  
  2762. If you don't have Internet or BBS access, many Linux distributions are
  2763. available via mail  order on  diskette,  tape, or  CD-ROM. Appendix  B
  2764. lists a number  of these  distributors.   Many of  them accept  credit
  2765. cards as well as international orders, so if you're not  in the United
  2766. States or Canada you still should be able to obtain Linux in this way.
  2767.   Linux is  free software,  although distributors are  allowed by  the
  2768. GPL to  charge a  fee for  it.   Therefore,  ordering  Linux via  mail
  2769. order might  cost  you between  US$30  and US$150,  depending  on  the
  2770. distribution.  However, if you know someone who  has already purchased
  2771. or downloaded a release of Linux, you are free to borrow or copy their
  2772. software for your  own use.    Linux distributors are  not allowed  to
  2773. 2.1.   Distributions of Linux                                       43
  2774. _______________________________________________________________________
  2775.  
  2776. restrict the license  or redistribution  of the software  in any  way.
  2777. If you are thinking  about installing an  entire lab of machines  with
  2778. Linux, for example, you only need to purchase a single copy  of one of
  2779. the distributions, which can be used to install all of the machines.
  2780.  
  2781. 2.1.4 Getting Slackware
  2782.  
  2783. Slackware is a  popular distribution  of Linux  maintained by  Patrick
  2784. Volkerding.(3)  It is easy to install and fairly complete,  and may be
  2785. obtained both from the Internet as well as on CD-ROM from  a number of
  2786. vendors (see Appendix B).
  2787.   The Slackware  distribution consists of a  number of ``disk  sets'',
  2788. each one containing a particular type of software (for example,  the d
  2789. disk set contains development tools such as the gcc compiler,  and the
  2790. x disk set contains the X Window  System software).  You can  elect to
  2791. install whatever disk sets you like, and can install new ones later.
  2792.   The version of Slackware  described here is 2.0.0, of 25  June 1994.
  2793. Installation of later versions of Slackware should be very  similar to
  2794. the information given here.
  2795.  
  2796. 2.1.4.1 Slackware disk sets
  2797.  
  2798. Unfortunately,  Slackware  does  not  maintain  a  complete   list  of
  2799. diskspace requirements  for  each disk  set.    You  need at  least  7
  2800. megabytes to install  just the  ``A'' series  of disks;  a very  rough
  2801. estimate of the  required diskspace would  be 2  or 2.5 megabytes  per
  2802. disk.
  2803.   The following disk sets are available:
  2804.  
  2805. A          The base  system.   Enough to get  up and running and  have
  2806.            elvis and comm programs available.   Based around the 1.0.9
  2807.            Linux kernel, and the new filesystem standard (FSSTND).
  2808.            These disks  are known to fit  on 1.2M disks, although  the
  2809.            rest of Slackware  won't.  If you have only a  1.2M floppy,
  2810.            you  can  still install  the  base system,  download  other
  2811.            disks you want and install them from your hard drive.
  2812.  
  2813. AP         Various  applications  and  add ons,  such  as  the  manual
  2814.            pages,  groff,  ispell  (GNU and  international  versions),
  2815.            term,  joe,  jove,  ghostscript,  sc,  bc,  and  the  quota
  2816.            patches.
  2817.  
  2818. D          Program  development.    GCC/G++/Objective  C  2.5.8,  make
  2819.            (GNU  and BSD), byacc  and GNU  bison, flex,  the 4.5.26  C
  2820.            libraries, gdb, kernel source for  1.0.9, SVGAlib, ncurses,
  2821.            clisp, f2c, p2c, m4, perl, rcs.
  2822.  
  2823. ----------------------------
  2824.  3.  Patrick   Volkerding  can   be  reached   on   the  Internet   at
  2825. volkerdi@mhd1.moorhead.msus.edu.
  2826. 2.1.   Distributions of Linux                                       44
  2827. _______________________________________________________________________
  2828.  
  2829. E          GNU Emacs 19.25.
  2830.  
  2831. F          A collection of FAQs and other documentation.
  2832.  
  2833. I          Info  pages for GNU  software.   Documentation for  various
  2834.            programs readable by info or Emacs.
  2835.  
  2836. N          Networking.  TCP/IP, UUCP, mailx,  dip, deliver, elm, pine,
  2837.            smail, cnews, nn, tin, trn.
  2838.  
  2839. OOP        Object Oriented Programming.  GNU  Smalltalk 1.1.1, and the
  2840.            Smalltalk Interface to X (STIX).
  2841. Q          Alpha  kernel source and  images (currently contains  Linux
  2842.            1.1.18).
  2843.  
  2844. TCL        Tcl, Tk, TclX, blt, itcl.
  2845.  
  2846. Y          Games.      The  BSD  games  collection,  and   Tetris  for
  2847.            terminals.
  2848.  
  2849. X          The base XFree86 2.1.1 system, with  libXpm, fvwm 1.20, and
  2850.            xlock added.
  2851.  
  2852. XAP        X applications:  X11 ghostscript,  libgr13, seyon, workman,
  2853.            xfilemanager,  xv  3.01, GNU  chess  and xboard,  xfm  1.2,
  2854.            ghostview, and various X games.
  2855.  
  2856. XD         X11  program development.   X11 libraries, server  linkkit,
  2857.            PEX support.
  2858.  
  2859. XV         Xview 3.2  release 5.   XView libraries, and the Open  Look
  2860.            virtual and non-virtual window managers.
  2861. IV         Interviews libraries, include files, and  the doc and idraw
  2862.            apps.
  2863.  
  2864. OI         ParcPlace's  Object   Builder  2.0  and  Object   Interface
  2865.            Library   4.0,   generously   made  available   for   Linux
  2866.            developers according  to the terms in the  "copying" notice
  2867.            found  in these  directories.   Note that  these only  work
  2868.            with  libc-4.4.4, but a  new version  may be released  once
  2869.            gcc 2.5.9 is available.
  2870.  
  2871. T          The TeX and LaTeX text formatting systems.
  2872.  
  2873.   You must get the ``A'' disk set; the rest are  optional.  We suggest
  2874. installing the A, AP, and D sets, as well as the X set if  you plan to
  2875. run the X Window System.
  2876. 2.1.   Distributions of Linux                                       45
  2877. _______________________________________________________________________
  2878.  
  2879. 2.1.4.2 Getting Slackware from the Internet
  2880.  
  2881. The Slackware release of Linux may be found on any number of FTP sites
  2882. worldwide.   Appendix  C lists  several  of the  Linux FTP  sites;  we
  2883. suggest that you try to find the software on the FTP site nearest you,
  2884. to reduce net traffic.   However, two of the major Linux  FTP archives
  2885. are sunsite.unc.edu and tsx-11.mit.edu.
  2886.   The Slackware release may be found at least on the following sites:
  2887.  
  2888.  o  sunsite.unc.edu:/pub/Linux/distributions/slackware
  2889.  
  2890.  o  tsx-11.mit.edu:/pub/linux/packages/slackware
  2891.  
  2892.  o  ftp.cdrom.com:/pub/linux/slackware
  2893.  
  2894.   ftp.cdrom.com is Slackware's home site.
  2895.  
  2896. 2.1.4.2.1 Downloading the  files You  should  download  the  following
  2897. files using  FTP.  Be  sure  to use  binary  mode  when  transferring.
  2898. Appendix C contains a complete tutorial on using FTP.
  2899.  
  2900.  o  The various README  files,  as well as  SLACKWARE_FAQ.  Be sure  to
  2901.     read these files before attempting to install the software, to get
  2902.     any updates or changes to this document.
  2903.  
  2904.  o  A bootdisk image.  This is a file that you will write  to a floppy
  2905.     to create the Slackware  boot disk.   If you have a 1.44  megabyte
  2906.     boot floppy (3.5"), look  in the directory  bootdsks.144.  If  you
  2907.     have a 1.2  megabyte boot  floppy (5.25"),  look in the  directory
  2908.     bootdsks.12.
  2909.  
  2910.     You need one of the following bootdisk files.
  2911.  
  2912.  
  2913.     --  bare.gz.  This is a  boot floppy that has only IDE  hard drive
  2914.         drivers.  (No SCSI, CD-ROM, or networking support.)   Use this
  2915.         if you only have an IDE hard drive controller and aren't going
  2916.         to be installing over the network or from CD-ROM.
  2917.  
  2918.     --  cdu31a.gz.    Contains  IDE,  SCSI, and  the  Sony  CDU31A/33A
  2919.         driver.
  2920.  
  2921.     --  mitsumi.gz.    Contains  IDE,  SCSI, and  the  Mitsumi  CD-ROM
  2922.         driver.
  2923.  
  2924.     --  modern.gz.  An experimental boot disk with a newer kernel, and
  2925.         all drivers except  those for network cards  and the Sony  535
  2926.         CD-ROM.
  2927.  
  2928.     --  net.gz.  Contains IDE and network drivers.
  2929. 2.1.   Distributions of Linux                                       46
  2930. _______________________________________________________________________
  2931.  
  2932.     --  sbpcd.gz.  Contains IDE, SCSI, and  SoundBlaster Pro/Panasonic
  2933.         CD-ROM drivers.
  2934.  
  2935.     --  scsi.gz.  Contains IDE, SCSI, and SCSI CD-ROM drivers.
  2936.  
  2937.     --  scsinet.gz.   Contains  IDE, SCSI,  SCSI  CD-ROM, and  network
  2938.         drivers.
  2939.  
  2940.     --  sony535.gz.    Contains IDE,  SCSI,  and Sony  535/531  CD-ROM
  2941.         drivers.
  2942.  
  2943.     --  xt.gz.  Contains IDE and XT hard drive drivers.
  2944.  
  2945.  
  2946.     You need only one of  the above bootdisk images, depending  on the
  2947.     hardware that you have in your system.
  2948.  
  2949.     The issue here  is that some hardware  drivers conflict with  each
  2950.     other in strange ways, and instead of attempting to debug hardware
  2951.     problems on your  system it's easier  to use  a boot floppy  image
  2952.     with only certain drivers enabled.  Most users  should try scsi.gz
  2953.     or bare.gz.
  2954.  
  2955.  o  A rootdisk image.  This is a file that you will write  to a floppy
  2956.     to create the Slackware installation  disk.  As with  the bootdisk
  2957.     image, look in rootdsks.144  or rootdsks.12 depending on the  type
  2958.     of boot floppy drive that you have.
  2959.  
  2960.     You need one of the following files:
  2961.  
  2962.  
  2963.     --  color144.gz.  The menu-based color installation disk  for 1.44
  2964.         megabyte drives.  Most users should use this rootdisk.
  2965.  
  2966.     --  umsds144.gz.   A version of the  color144 disk for  installing
  2967.         with the UMSDOS filesystem, which allows you to  install Linux
  2968.         onto a directory of an  MS-DOS filesystem.   This installation
  2969.         method is not  discussed in detail here,  but it will  prevent
  2970.         you from  having to  repartition your  drive.    More on  this
  2971.         later.
  2972.  
  2973.     --  tty144.gz.    The terminal-based  installation disk  for  1.44
  2974.         megabyte drives.   If  color144.gz doesn't work  for you,  try
  2975.         tty144.gz instead.
  2976.  
  2977.     --  colrlite.gz.  The  menu-based color installation disk for  1.2
  2978.         megabyte drives.
  2979.  
  2980.     --  umsds12.gz.   A version  of the colrlite  disk for  installing
  2981.         with  the  UMSDOS  filesystem.      See  the  description   of
  2982. 2.1.   Distributions of Linux                                       47
  2983. _______________________________________________________________________
  2984.  
  2985.         umsds144.gz, above.
  2986.  
  2987.     --  tty12.gz.    The  terminal-based  installation  disk  for  1.2
  2988.         megabyte drives.  Use this rootdisk if you have a 1.2 megabyte
  2989.         boot floppy and colrlite.gz doesn't work for you.
  2990.  
  2991.  
  2992.     Again, you need only one  of the above rootdisk images,  depending
  2993.     on the type of boot floppy drive that you have.
  2994.  
  2995.  o  GZIP.EXE. This is  an MS-DOS  executable of  the gzip  compression
  2996.     program used  to compress  the boot  and rootdisk  files (the  .gz
  2997.     extension on the filenames indicates this).  This can  be found in
  2998.     the install directory.
  2999.  
  3000.  o  RAWRITE.EXE. This  is  an  MS-DOS  program  that  will  write  the
  3001.     contents of a file (such as the boot and rootdisk images) directly
  3002.     to a floppy, without regard to  format.  You will  use RAWRITE.EXE
  3003.     to create the boot and  root floppies.   This can be found in  the
  3004.     install directory as well.
  3005.  
  3006.     You only need RAWRITE.EXE and  GZIP.EXE if you plan to  create the
  3007.     boot and root floppies from an MS-DOS system.  If  you have access
  3008.     to a UNIX workstation with a floppy drive instead,  you can create
  3009.     the floppies from there, using the  dd command.  See the  man page
  3010.     for dd and ask your local UNIX administrators for assistance.
  3011.  
  3012.  o  The  files  in  the  directories  slakware/a1,  slakware/a2,   and
  3013.     slakware/a3.   These  files  make up  the ``A''  disk  set of  the
  3014.     Slackware distribution.    They are  required.   Later,  you  will
  3015.     copy these files to MS-DOS floppies for installation (or,  you can
  3016.     install from your hard drive).  Therefore, when you download these
  3017.     files, keep them in separate  directories; don't mix the  a1 files
  3018.     with the a2 files, and so on.
  3019.  
  3020.     Be sure that you get the files without periods in the filenames as
  3021.     well.  That is, within FTP, use the command ``mget  *'' instead of
  3022.     ``mget *.*''.
  3023.  
  3024.  o  The files in  the directories ap1,  ap2, etc.,  depending on  what
  3025.     disk sets you are installing.  For example, if  you are installing
  3026.     the ``X'' disk series, get the files in the directories x1 through
  3027.     x5.  As with the ``A'' disk set, above, be sure to  keep the files
  3028.     in separate directories when you download them.
  3029.  
  3030. 2.1.4.3 Getting Slackware on CD-ROM
  3031.  
  3032. Slackware is also available on  CD-ROM. Most Slackware CD-ROMs  simply
  3033. contain a copy of the files  as they appear on the FTP  archive sites,
  3034. as described above.   Therefore, if you  have a Slackware CD-ROM,  you
  3035. 2.1.   Distributions of Linux                                       48
  3036. _______________________________________________________________________
  3037.  
  3038. have all of the files that you need.
  3039.   You will  have to create a  boot and root  floppy from the files  on
  3040. the CD-ROM. See  Section 2.1.4.2.1,  above,  for a  discussion on  the
  3041. available boot and root disk images.
  3042.   First, decide which  boot and root disk images  you will use.   They
  3043. should all be  on the CD-ROM.  Below, we will  describe how to  create
  3044. these floppies.
  3045.  
  3046. 2.1.4.4 Installation methods
  3047.  
  3048. Slackware provides several different means of installing the software.
  3049. The most popular is installing  from an MS-DOS partition on  your hard
  3050. drive; another is  to install  from a set  of MS-DOS floppies  created
  3051. from the disk sets that you downloaded.
  3052.   If  you have  Slackware  on a  CD-ROM,  you  can install  the  files
  3053. directly from  there.    The Slackware  Pro distribution,  from  Morse
  3054. Telecommunications, allows you to install Slackware so that many files
  3055. are accessed  directly on  the  CD-ROM. This  can  save a  great  deal
  3056. of space on your  hard drive, with  the tradeoff that running  certain
  3057. applications will be slower.
  3058.  
  3059. 2.1.4.4.1 Creating the boot and root floppies You must create floppies
  3060. from the bootdisk and rootdisk images that you downloaded (or  have on
  3061. CD-ROM), no matter what type of installation you will be doing.
  3062.   On an MS-DOS system,  you must uncompress the bootdisk  and rootdisk
  3063. images using  GZIP.EXE.  For  example,  if you're  using  the  bare.gz
  3064. bootdisk image, issue the MS-DOS command:
  3065.  
  3066.     C:\> GZIP -D BARE.GZ
  3067.  
  3068. which will uncompress bare.gz and  leave you with the  file bare.   If
  3069. you are installing from CD-ROM, you can copy the bootdisk  image (such
  3070. as bare.gz) to  you hard drive,  and run GZIP.EXE  from the CD-ROM  to
  3071. uncompress it.
  3072.   You must similarly uncompress  the rootdisk image.  For  example, if
  3073. you are using the rootdisk color144.gz, issue the command:
  3074.  
  3075.     C:\> GZIP -D COLOR144.GZ
  3076.  
  3077. which will uncompress the file and leave you with color144.
  3078.   Next,  you must  have two  high-density  MS-DOS formatted  floppies.
  3079. (They must be of  the same type;  that is, if  your boot floppy  drive
  3080. is a 3.5" drive, both floppies must be high-density 3.5" disks.)   You
  3081. will use RAWRITE.EXE  to write  the boot  and rootdisk  images to  the
  3082. floppies.
  3083.   Issue the command:
  3084.  
  3085.     C:\> RAWRITE
  3086.  
  3087.   Answer the prompts for the name of the file to  write (such as bare,
  3088. 2.1.   Distributions of Linux                                       49
  3089. _______________________________________________________________________
  3090.  
  3091. or color144) and  the floppy to  write it to  (such as  A:).   RAWRITE
  3092. will copy the file, block-by-block, directly to the floppy.   Also use
  3093. RAWRITE for the root disk  image.  When  you're done, you'll have  two
  3094. floppies:  one containing the boot disk, the other containing the root
  3095. disk.   Note that  these two floppies  will no  longer be readable  by
  3096. MS-DOS (they are ``Linux format'' floppies, in some sense).
  3097.   Be sure  that  you're using  brand-new, error-free  floppies.    The
  3098. floppies must have no bad blocks on them.
  3099.   Note that you do not  need to be running MS-DOS in order  to install
  3100. Slackware.  However, running MS-DOS makes it easier to create the boot
  3101. and root floppies, and it makes it easier to install  the software (as
  3102. you can install directly from an MS-DOS partition on your system).  If
  3103. you are not running MS-DOS on your system, you can  use someone else's
  3104. MS-DOS system just to create the floppies, and install from there.
  3105.   It is not necessary to use GZIP.EXE and  RAWRITE.EXE under MS-DOS to
  3106. create the boot and root floppies, either.   You can use the  gzip and
  3107. dd commands on a UNIX system to do the same job.  (For  this, you will
  3108. need a UNIX workstation with a floppy drive, of course.)  For example,
  3109. on a Sun workstation  with the floppy  drive on device /dev/rfd0,  you
  3110. can use the commands:
  3111.  
  3112.     $ gunzip bare.gz
  3113.     $ dd if=bare of=/dev/rfd0 obs=18k
  3114.  
  3115.   You  must provide  the  appropriate  block size  argument  (the  obs
  3116. argument) on some workstations (e.g., Suns) or this will fail.  If you
  3117. have problems the man page for dd will be instructive.
  3118.  
  3119. 2.1.4.4.2 Preparing  for  installation   from  hard  drive If   you're
  3120. planning on  installing  the  Slackware  software  directly  from  the
  3121. hard drive (which  is often  faster and  more reliable  than a  floppy
  3122. installation), you will  need an MS-DOS partition  on the system  that
  3123. you're installing Slackware to.
  3124.   Note:  If  you plan to install  Slackware from an MS-DOS  partition,
  3125. that partition  must  NOT  be compressed  with  DoubleSpace,  Stacker,
  3126. or any  other  MS-DOS drive  compression  utility.    Linux  currently
  3127. cannot read DoubleSpace/Stacker MS-DOS partitions directly.   (You can
  3128. access them via the  MS-DOS Emulator, but that  is not an option  when
  3129. installing the Linux software.)
  3130.   To prepare  for hard drive installation,  simply create a  directory
  3131. on the hard drive to store the Slackware files.  For example,
  3132.  
  3133.     C:\> MKDIR SLACKWAR
  3134.  
  3135.   will create the  directory C:\SLACKWAR to hold the  Slackware files.
  3136. Under this directory, you should create subdirectories A1, A2,  and so
  3137. on, for each disk  set that you  downloaded, using the MKDIR  command.
  3138. All of  the  files from  the  A1 disk  should  go into  the  directory
  3139. SLACKWAR\A1, and so forth.
  3140. 2.2.   Preparing to Install Linux                                   50
  3141. _______________________________________________________________________
  3142.  
  3143. 2.1.4.4.3 Preparing for  floppy installation If  you  wish to  install
  3144. Slackware from floppies instead of the hard drive, you'll need to have
  3145. one blank, MS-DOS  formatted floppy for each  Slackware disk that  you
  3146. downloaded.  These disks must be high-density format.
  3147.   The A  disk set (disks A1  through A3) may  be either 3.5" or  5.25"
  3148. floppies.   However, the  rest of the  disk sets  must be 3.5"  disks.
  3149. Therefore, if  you only  have a  5.25" floppy  drive,  you'll need  to
  3150. borrow a 3.5" drive from someone  in order to install disk  sets other
  3151. than A. (Or, you can install from the hard drive, as  explained in the
  3152. previous section.)
  3153.   To  make the  disks,  simply  copy  the files  from  each  Slackware
  3154. directory onto  an  MS-DOS formatted  floppy,  using the  MS-DOS  COPY
  3155. command.  As so:
  3156.  
  3157.     C:\> COPY A1\*.* A:
  3158.  
  3159. will copy the contents of the A1 disk to the floppy in drive A:.   You
  3160. should repeat this for each disk that you downloaded.
  3161.   You do  not need  to modify  or uncompress  the files  on the  disks
  3162. in any way;  you merely need  to copy  them to MS-DOS  floppies.   The
  3163. Slackware installation procedure takes care of uncompressing the files
  3164. for you.
  3165.  
  3166. 2.1.4.4.4 Preparing for CD-ROM installation If you have Slackware on a
  3167. CD-ROM, you are ready  to install the  software once you have  created
  3168. the boot and root floppies.   The software will be  installed directly
  3169. from CD.
  3170.  
  3171.  
  3172. 2.2 Preparing to Install Linux
  3173.  
  3174. After you  have obtained  a  distribution of  Linux,  you're ready  to
  3175. prepare your system  for installation.   This  takes a certain  degree
  3176. of planning,  especially  if you're  already running  other  operating
  3177. systems.  In the following sections we'll describe how to plan for the
  3178. Linux installation.
  3179.  
  3180. 2.2.1 Installation overview
  3181.  
  3182. While each release of Linux is  different, in general the  method used
  3183. to install the software is as follows:
  3184.  
  3185. 1.  Repartition your  hard drive(s).    If  you have  other  operating
  3186.     systems already installed, you will need to repartition the drives
  3187.     in order  to allocate  space  for Linux.    This  is discussed  in
  3188.     Section 2.2.4, below.
  3189.  
  3190. 2.  Boot  the  Linux  installation  media.     Each   distribution  of
  3191.     Linux has  some  kind  of installation  media---usually  a  ``boot
  3192.     floppy''---which is used  to install the software.   Booting  this
  3193. 2.2.   Preparing to Install Linux                                   51
  3194. _______________________________________________________________________
  3195.  
  3196.     media will  either  present you  with  some kind  of  installation
  3197.     program, which will  step you through  the Linux installation,  or
  3198.     allow you to install the software by hand.
  3199.  
  3200. 3.  Create Linux partitions.   After repartitioning to allocate  space
  3201.     for Linux,  you  create  Linux  partitions on  that  empty  space.
  3202.     This is  accomplished with  the Linux  fdisk program,  covered  in
  3203.     Section 2.3.3.
  3204.  
  3205. 4.  Create filesystems and swap space.  At this point, you will create
  3206.     one or more filesystems, used to store files, on the newly-created
  3207.     partitions.  In addition, if you plan to use swap  space, you will
  3208.     create the swap space  on one of your  Linux partitions.  This  is
  3209.     covered in Sections 2.3.4 and 2.3.5.
  3210.  
  3211. 5.  Install the software on  the new filesystems.   Finally, you  will
  3212.     install the  Linux  software  on your  newly-created  filesystems.
  3213.     After this,  it's smooth  sailing---if all  goes  well.   This  is
  3214.     covered in Section 2.3.6.  Later, in Section 2.5, we describe what
  3215.     to do if anything goes wrong.
  3216.  
  3217.   Many distributions  of Linux provide  an installation program  which
  3218. will step you through  the installation process,  and automate one  or
  3219. more of the above steps for you.  Keep in mind throughout this chapter
  3220. that any number of the above steps may be automated for you, depending
  3221. on the distribution.
  3222.   The Slackware  distribution of  Linux,  covered in  this book,  only
  3223. requires you to repartition your drive, using fdisk, and use the setup
  3224. program to accomplish the other steps.
  3225.   Important hint:  While  preparing to install Linux, the  best advice
  3226. that we can give is to take notes during the entire procedure.   Write
  3227. down everything that you do, everything that you type,  and everything
  3228. that you see  that might be  out of the  ordinary.   The idea here  is
  3229. simple:  if  (or when!)   you run  into trouble, you  want to be  able
  3230. to retrace your steps and find out what went wrong.   Installing Linux
  3231. isn't difficult, but  there are many  details to remember.   You  want
  3232. to have a record of  all of these details  so that you can  experiment
  3233. with other methods if something goes wrong.  Also,  keeping a notebook
  3234. of your Linux installation experience  is useful when you want  to ask
  3235. other people for help, for example,  when posting a message to  one of
  3236. the Linux-related USENET groups.  Your notebook is also something that
  3237. you'll want to show to your grandchildren someday.(4)
  3238.  
  3239. ----------------------------
  3240.  4. The author shamefully admits that he kept a notebook of all of his
  3241. tribulations with Linux for the  first few months of working  with the
  3242. system.  It is now gathering dust on his bookshelf.
  3243. 2.2.   Preparing to Install Linux                                   52
  3244. _______________________________________________________________________
  3245.  
  3246. 2.2.2 Repartitioning concepts
  3247.  
  3248. In general, hard drives  are divided into  partitions, where a  single
  3249. partition is devoted to  a single operating system.   For example,  on
  3250. one hard drive, you may have several separate partitions---one devoted
  3251. to, say, MS-DOS, another to OS/2, and another to Linux.
  3252.   If you  already have other  software installed  on your system,  you
  3253. may need to  resize those  partitions in  order to free  up space  for
  3254. Linux.   You will  then create  one or  more Linux  partitions on  the
  3255. resulting free space for  storing the Linux  software and swap  space.
  3256. We call this process repartitioning.
  3257.   Many  MS-DOS  systems utilize  a  single  partition  inhabiting  the
  3258. entire drive.  To MS-DOS, this partition is known as C:.   If you have
  3259. more than one partition, MS-DOS  names them D:, E:, and  so on.   In a
  3260. way, each partition acts like a separate hard drive.
  3261.   On the first sector of  the disk is a master boot record  along with
  3262. a partition table.  The boot  record (as the name implies) is  used to
  3263. boot the system.   The partition table contains information  about the
  3264. locations and sizes of your partitions.
  3265.   There  are  three kinds  of  partitions:    primary,  extended,  and
  3266. logical.  Of these, primary partitions are used most often.   However,
  3267. because of a limit in  the size of the  partition table, you can  only
  3268. have four primary partitions on any given drive.
  3269.   The  way around  this four-partition  limit is  to  use an  extended
  3270. partition.     An  extended   partition  doesn't  hold  any  data   by
  3271. itself; instead, it  acts as a  ``container'' for logical  partitions.
  3272. Therefore, you  could  create  one extended  partition,  covering  the
  3273. entire drive, and within it create many logical partitions.   However,
  3274. you may have only one extended partition per drive.
  3275.  
  3276. 2.2.3 Linux partition requirements
  3277.  
  3278. Before we explain how to repartition your drives, you need  to have an
  3279. idea of how much space you will  be allocating for Linux.  We  will be
  3280. discussing how to create these partitions later, in Section 2.3.3.
  3281.   On  UNIX  systems,  files are  stored  on  a  filesystem,  which  is
  3282. essentially a section  of the  hard drive  (or other  medium, such  as
  3283. CD-ROM or  diskette) formatted  to hold  files.    Each filesystem  is
  3284. associated with a specific  part of the  directory tree; for  example,
  3285. on many systems,  there is a filesystem  for all of  the files in  the
  3286. directory /usr, another for /tmp, and  so on.  The root  filesystem is
  3287. the primary filesystem, which corresponds to the topmost directory, /.
  3288.  
  3289.   Under Linux,  each filesystem lives on  a separate partition on  the
  3290. hard drive.  For instance, if you have a filesystem for  / and another
  3291. for /usr, you will need two partitions to hold the two filesystems.
  3292.   Before you install Linux,  you will need to prepare  filesystems for
  3293. storing the Linux  software.   You must have  at least one  filesystem
  3294. (the root  filesystem),  and  therefore one  partition,  allocated  to
  3295. Linux.   Many  Linux users  opt to  store all  of their  files on  the
  3296. 2.2.   Preparing to Install Linux                                   53
  3297. _______________________________________________________________________
  3298.  
  3299. root filesystem, which is in most cases easier to  manage than several
  3300. filesystems and partitions.
  3301.   However,  you  may create  multiple  filesystems  for Linux  if  you
  3302. wish---for example, you may want to use separate filesystems  for /usr
  3303. and /home.  Those  readers with UNIX system administration  experience
  3304. will know how to use multiple filesystems creatively.  In Chapter 4 we
  3305. discuss the use of multiple partitions and filesystems.
  3306.   Why use more than  one filesystem?  The most commonly  stated reason
  3307. is safety; if,  for some reason, one  of your filesystems is  damaged,
  3308. the others will  (usually) be unharmed.    On the other  hand, if  you
  3309. store all of your  files on the root  filesystem, and for some  reason
  3310. the filesystem is damaged, then you may lose all of your  files in one
  3311. fell swoop.   This  is, however,  rather uncommon;  if you backup  the
  3312. system regularly you should be quite safe.(5)
  3313.   Another reason to  use multiple filesystems  is to divvy up  storage
  3314. between multiple hard  drives.   If you have,  say, 40 megabytes  free
  3315. on one hard drive,  and 50 megabytes free  on another, you might  want
  3316. to create  a 40-megabyte  root filesystem  on the  first  drive and  a
  3317. 50-megabyte /usr  filesystem  on the  other.    Currently  it  is  not
  3318. possible for a single filesystem to span multiple drives; if your free
  3319. hard drive storage is fragmented  between drives you will need  to use
  3320. multiple filesystems to utilize it all.
  3321.   In summary,  Linux requires  at least  one partition,  for the  root
  3322. filesystem.   If you  wish to  create multiple  filesystems, you  will
  3323. need a  separate  partition for  each  additional  filesystem.    Some
  3324. distributions of Linux automatically create partitions and filesystems
  3325. for you, so you may not need to worry about these issues at all.
  3326.   Another issue  to  consider when  planning your  partitions is  swap
  3327. space.   If  you wish  to  use swap  space with  Linux,  you have  two
  3328. options.  The first is to use a swap file which exists on  one of your
  3329. Linux filesystems.  You will  create the swap file for use  as virtual
  3330. RAM after you install the software.  The second option is  to create a
  3331. swap partition, an individual partition to be used only as swap space.
  3332. Most people use a swap partition instead of a swap file.
  3333.   A single swap file or  partition may be up to 16 megabytes  in size.
  3334. If you wish  to use more  than 16  megabytes of swap,  you can  create
  3335. multiple swap partitions or files---up to eight in all.   For example,
  3336. if you need 32 megabytes of swap, you can create  two 16-megabyte swap
  3337. partitions.
  3338.   Setting  up a  swap  partition  is covered  in  Section  2.3.4,  and
  3339. setting up a swap file in Chapter 4.
  3340.   Therefore, in general,  you will create at least two  partitions for
  3341. Linux:  one for use as the  root filesystem, and the other for  use as
  3342. swap space.  There are,  of course, many variations on the  above, but
  3343. this is the minimal  setup.   You are not  required to use swap  space
  3344. with Linux, but if you have less than 16 megabytes of  physical RAM it
  3345.  
  3346. ----------------------------
  3347.  5. The author uses  a single 200-megabyte  filesystem for all of  his
  3348. Linux files, and hasn't had any problems (so far).
  3349. 2.2.   Preparing to Install Linux                                   54
  3350. _______________________________________________________________________
  3351.  
  3352. is strongly suggested that you do.
  3353.   Of course, you need  to be aware of how much space  these partitions
  3354. will require.     The  size  of  your  Linux  filesystems  (containing
  3355. the software  itself)  depends greatly  on  how much  software  you're
  3356. installing and what distribution of  Linux you are using.   Hopefully,
  3357. the documentation that came  with your distribution  will give you  an
  3358. approximation of the  space requirements.   A  small Linux system  can
  3359. use 20 megabytes  or less;  a larger  system anywhere from  80 to  100
  3360. megabytes, or  more.   Keep  in mind  that  in addition  to the  space
  3361. required by the software itself, you need to allocate  extra space for
  3362. user directories, room for future expansion, and so forth.
  3363.   The  size of  your swap  partition  (should you  elect to  use  one)
  3364. depends on how much virtual  RAM you require.   A rule of thumb  is to
  3365. use a swap partition that is twice the space of your physical RAM; for
  3366. example, if you have 4  megabytes of physical RAM, an  8-megabyte swap
  3367. partition should suffice.   Of course, this is  mere speculation---the
  3368. actual amount of swap space  that you require depends on  the software
  3369. which you will be running.   If you have a great deal of  physical RAM
  3370. (say, sixteen megabytes or more), you  may not wish to use  swap space
  3371. at all.
  3372.   Important note:   Because  of BIOS  limitations, it  is usually  not
  3373. possible to boot from partitions  using cylinders numbered over  1023.
  3374. Therefore, when setting aside space  for Linux, keep in mind  that you
  3375. may not want to use a  partition in the >1023-cylinder range  for your
  3376. Linux root filesystem.  Linux can still use partitions  with cylinders
  3377. numbered over 1023, however,  you may not be  able to boot Linux  from
  3378. such a partition.  This advice may seem premature, but it is important
  3379. to know while planning your drive layout.
  3380.   If you absolutely must use a partition with  cylinders numbered over
  3381. 1023 for your Linux  root filesystem, you  can always boot Linux  from
  3382. floppy.  This is  not so bad,  actually---it only takes a few  seconds
  3383. longer to boot than from the hard drive.  At any rate,  it's always an
  3384. option.
  3385.  
  3386. 2.2.4 Repartitioning your drives
  3387.  
  3388. In this section, we'll describe how to resize your  current partitions
  3389. (if any) to  make space for  Linux.   If you  are installing Linux  on
  3390. a ``clean''  hard drive,  you can  skip  this section  and proceed  to
  3391. Section 2.3, below.
  3392.   The usual way to resize an existing partition is  to delete it (thus
  3393. destroying all of the data on that partition) and recreate it.  Before
  3394. repartitioning your drives,  backup your system.   After resizing  the
  3395. partitions, you can reinstall your original software from  the backup.
  3396. However, there  are several programs  available for  MS-DOS which  are
  3397. able to resize partitions nondestructively.  One of these  is known as
  3398. ``FIPS'', and can be found on many Linux FTP sites.
  3399.   Also, keep  in mind that because  you'll be shrinking your  original
  3400. partitions, you may not have space  to reinstall everything.   In this
  3401. case, you need to delete enough unwanted software to allow the rest to
  3402. 2.2.   Preparing to Install Linux                                   55
  3403. _______________________________________________________________________
  3404.  
  3405. fit on the smaller partitions.
  3406.   The program used to  repartition is known as fdisk.   Each operating
  3407. system has  its  own analogue  of  this program;  for  example,  under
  3408. MS-DOS, it is  invoked with  the FDISK  command.   You should  consult
  3409. your documentation for  whatever operating  systems you are  currently
  3410. running for information on repartitioning.  Here, we'll discuss how to
  3411. resize partitions for MS-DOS using FDISK, but this  information should
  3412. be easily extrapolated to other operating systems.
  3413.   Please consult the documentation for your  current operating systems
  3414. before repartitioning  your drive.    This section  is meant  to be  a
  3415. general overview of the process; there are many subtleties  that we do
  3416. not cover here.   You can lose all of  the software on your  system if
  3417. you do not repartition the drive correctly.
  3418.   A  warning:   Do  not modify  or  create  partitions for  any  other
  3419. operating systems  (including Linux)  using  FDISK under  MS-DOS.  You
  3420. should only modify partitions for  a particular operating system  with
  3421. the version of fdisk included with that operating system; for example,
  3422. you will create Linux partitions  using a version of fdisk  for Linux.
  3423. Later, in Section 2.3.3, we  describe how to create  Linux partitions,
  3424. but for now we are concerned with resizing your current ones.
  3425.   Let's  say  that you  have  a  single  hard drive  on  your  system,
  3426. currently devoted  entirely  to  MS-DOS. Hence,  your  drive  consists
  3427. of a  single MS-DOS  partition, commonly  known  as ``C:''.    Because
  3428. this repartitioning method  will destroy the  data on that  partition,
  3429. you need to create  a bootable MS-DOS  ``system disk'' which  contains
  3430. everything necessary to run FDISK and restore the software from backup
  3431. after the repartitioning is complete.
  3432.   In many cases,  you can use the  MS-DOS installation disks for  this
  3433. purpose.  However, if you need to create your own  system disk, format
  3434. a floppy with the command
  3435.  
  3436.     FORMAT /s A:
  3437.  
  3438. Copy onto this floppy all  of the necessary MS-DOS utilities  (usually
  3439. most of the software in the directory \DOS on your drive),  as well as
  3440. the programs FORMAT.COM and FDISK.EXE. You should now be able  to boot
  3441. this floppy, and run the command
  3442.  
  3443.     FDISK C:
  3444.  
  3445. to start up FDISK.
  3446.   Use of  FDISK should  be  self-explanatory, but  consult the  MS-DOS
  3447. documentation for  details.    When  you  start FDISK,  use  the  menu
  3448. option to display the partition table, and write down  the information
  3449. displayed there.  It  is important to keep  a record of your  original
  3450. setup in case you want to back out of the Linux installation.
  3451.   To  delete an  existing  partition,  choose  the FDISK  menu  option
  3452. ``Delete an MS-DOS Partition or Logical DOS Drive''.  Specify the type
  3453. of partition that you wish  to delete (primary, extended,  or logical)
  3454. and the number of the partition.  Verify all of the warnings.  Poof!
  3455. 2.3.   Installing the Linux software                                56
  3456. _______________________________________________________________________
  3457.  
  3458.   To create  a new  (smaller) partition  for MS-DOS,  just choose  the
  3459. FDISK option  ``Create an  MS-DOS Partition  or  Logical DOS  Drive''.
  3460. Specify the type  of partition  (primary, extended,  or logical),  and
  3461. the size of the partition to  create (specified in megabytes).   FDISK
  3462. should create the partition and you're ready to roll.
  3463.   After  you're done  using FDISK,  you should  exit  the program  and
  3464. reformat any new partitions.   For example,  if you resized the  first
  3465. DOS partition on your drive (C:) you should run the command
  3466.  
  3467.     FORMAT /s C:
  3468.  
  3469. You may now reinstall your original software from backup.
  3470.  
  3471.  
  3472. 2.3 Installing the Linux software
  3473.  
  3474. After you  have resized  your existing  partitions to  make space  for
  3475. Linux, you  are  ready to  install the  software.    Here is  a  brief
  3476. overview of the procedure:
  3477.  
  3478.  o  Boot the Linux installation media;
  3479.  
  3480.  o  Run fdisk under Linux to create Linux partitions;
  3481.  
  3482.  o  Run mke2fs and mkswap to create Linux filesystems and swap space;
  3483.  
  3484.  o  Install the Linux software;
  3485.  
  3486.  o  Finally, either install the LILO  boot loader on your  hard drive,
  3487.     or create a boot floppy in order to boot your new Linux system.
  3488.  
  3489.   As we have said,  one (or more) of these steps may be  automated for
  3490. you by the  installation procedure, depending  on the distribution  of
  3491. Linux which you are using.  Please consult the  documentation for your
  3492. distribution for specific instructions.
  3493.  
  3494. 2.3.1 Booting Linux
  3495.  
  3496. The first step  is to  boot the  Linux installation  media.   In  most
  3497. cases, this is a ``boot floppy'' which contains a  small Linux system.
  3498. Upon booting the floppy,  you will be  presented with an  installation
  3499. menu of some kind which will lead you through the  steps of installing
  3500. the software.   On other distributions, you  will be presented with  a
  3501. login prompt when  booting this floppy.   Here,  you usually login  as
  3502. root or install to begin the installation process.
  3503.   The documentation which came with your  particular distribution will
  3504. explain what is necessary to boot Linux from the installation media.
  3505.   If you are installing the Slackware distribution of  Linux, all that
  3506. is required  is to  boot  the boot  floppy which  you  created in  the
  3507. previous section.
  3508. 2.3.   Installing the Linux software                                57
  3509. _______________________________________________________________________
  3510.  
  3511.   Most  distributions of  Linux use  a boot  floppy  which allows  you
  3512. to enter  hardware parameters  at  a boot  prompt,  to force  hardware
  3513. detection of various devices.   For  example, if your SCSI  controller
  3514. is not detected when booting the  floppy, you will need to  reboot and
  3515. specify the hardware parameters (such  as I/O address and IRQ)  at the
  3516. boot prompt.
  3517.   Likewise, IBM PS/1,  ThinkPad, and ValuePoint machines do  not store
  3518. drive geometry in the CMOS, and you must specify it at boot time.
  3519.   The boot  prompt is often displayed  automatically when booting  the
  3520. boot floppy.  This is the case for the Slackware distribution.   Other
  3521. distributions require you to hold down [shift] or [ctrl] while booting
  3522. the floppy.  If successful, you should see the prompt
  3523.  
  3524.     boot:
  3525.  
  3526. and possibly other messages.
  3527.   To try booting without  any special parameters, just press  enter at
  3528. the boot prompt.
  3529.   Watch  the messages  as  the system  boots.    If  you have  a  SCSI
  3530. controller, you should see a listing  of the SCSI hosts detected.   If
  3531. you see the message
  3532.  
  3533.     SCSI: 0 hosts
  3534.  
  3535. then your SCSI controller was not  detected, and you will have  to use
  3536. the following procedure.
  3537.   Also, the  system will display  information on the drive  partitions
  3538. and devices detected.    If any  of this information  is incorrect  or
  3539. missing, you will have to force hardware detection.
  3540.   On the  other hand, if all  goes well and  you hardware seems to  be
  3541. detected, you can skip to the following section, Section 2.3.2.
  3542.   To  force  hardware  detection,  you   must  enter  the  appropriate
  3543. parameters at the boot prompt, using the following syntax:
  3544.  
  3545.     ramdisk <parameters...>
  3546.  
  3547.   There are a  number of such parameters  available; here are some  of
  3548. the most common.
  3549.  
  3550. hd=<cylinders>,<heads>,<sectors>
  3551.            Specify the harddrive geometry.   Required for systems such
  3552.            as the  IBM PS/1, ValuePoint,  and ThinkPad.  For  example,
  3553.            if your drive  has 683 cylinders, 16 heads, and  32 sectors
  3554.            per track, enter
  3555.  
  3556.                ramdisk hd=683,16,32
  3557.  
  3558.  
  3559. tmc8xx=<memaddr>,<irq>
  3560.            Specify  address  and  IRQ  for   BIOS-less  Future  Domain
  3561.            TMC-8xx SCSI controller.  For example,
  3562. 2.3.   Installing the Linux software                                58
  3563. _______________________________________________________________________
  3564.  
  3565.                ramdisk tmc8xx=0xca000,5
  3566.  
  3567.  
  3568.            Note that the  0x prefix must be used for all  values given
  3569.            in  hexadecimal.   This is  true for all  of the  following
  3570.            options.
  3571. st0x=<memaddr>,<irq>
  3572.            Specify  address   and  IRQ  for  BIOS-less   Seagate  ST02
  3573.            controller.
  3574.  
  3575. t128=<memaddr>,<irq>
  3576.            Specify  address  and  IRQ  for   BIOS-less  Trantor  T128B
  3577.            controller.
  3578.  
  3579.            ncr5380=<port>,<irq>,<dma>   Specify  port,   IRQ,  and   DMA
  3580.            channel for generic NCR5380 controller.
  3581.  
  3582. aha152x=<port>,<irq>,<scsi_id>,1
  3583.            Specify  port,  IRQ, and  SCSI  ID for  BIOS-less  AIC-6260
  3584.            controllers.     This  includes  Adaptec  1510,  152x,  and
  3585.            Soundblaster-SCSI controllers.
  3586.  
  3587.   For each of these, you must enter ramdisk  followed by the parameter
  3588. that you wish to use.
  3589.   If you  have questions  about these boot-time  options, please  read
  3590. the Linux  SCSI HOWTO,  which should  be available  on  any Linux  FTP
  3591. archive site (or from wherever you obtained this book), as well as the
  3592. Linux CD-ROM HOWTO. These documents describe hardware compatibility in
  3593. much more detail.
  3594.  
  3595. 2.3.2 Drives and partitions under Linux
  3596.  
  3597. Many distributions  require you  to create  Linux  partitions by  hand
  3598. using the fdisk program.   Others may automatically create  partitions
  3599. for you.  Either way, you should know the  following information about
  3600. Linux partitions and device names.
  3601.   Drives and  partitions under  Linux are given  different names  than
  3602. their counterparts  under  other operating  systems.    Under  MS-DOS,
  3603. floppy drives  are  referred  to  as  A:  and  B:,  while  hard  drive
  3604. partitions are named  C:, D:,  and so  on.   Under  Linux, the  naming
  3605. convention is quite different.
  3606.   Device  drivers,   found  in  the  directory   /dev,  are  used   to
  3607. communicate with devices on  your system (such  as hard drives,  mice,
  3608. and so on).   For  example, if you  have a mouse  on your system,  you
  3609. access it through the driver /dev/mouse.  Floppy drives,  hard drives,
  3610. and individual partitions are all  given individual device drivers  of
  3611. their own.  Don't worry about the device driver interface for  now; it
  3612. is important only to understand  how the various devices are  named in
  3613. order to use them.
  3614.   Table 2.1 lists the names of these various device drivers.
  3615. 2.3.   Installing the Linux software                                59
  3616. _______________________________________________________________________
  3617.  
  3618.         Device                                       Name
  3619.  
  3620.         First floppy (A:)                            /dev/fd0
  3621.         Second floppy (B:)                           /dev/fd1
  3622.         First hard drive (entire drive)              /dev/hda
  3623.         First hard drive, primary partition 1        /dev/hda1
  3624.         First hard drive, primary partition 2        /dev/hda2
  3625.         First hard drive, primary partition 3        /dev/hda3
  3626.         First hard drive, primary partition 4        /dev/hda4
  3627.         First hard drive, logical partition 1        /dev/hda5
  3628.         First.hard drive, logical partition 2        /dev/hda6
  3629.         ..
  3630.  
  3631.         Second hard drive (entire drive)             /dev/hdb
  3632.         Second.hard drive, primary partition 1       /dev/hdb1
  3633.         ..
  3634.         First SCSI hard drive (entire drive)         /dev/sda
  3635.         First.SCSI hard drive, primary partition 1   /dev/sda1
  3636.  
  3637.         ..
  3638.         Second SCSI hard drive (entire drive)        /dev/sdb
  3639.         Second.SCSI hard drive, primary partition 1  /dev/sdb1
  3640.         ..
  3641.  
  3642.                   Table 2.1:  Linux partition names
  3643.  
  3644.  
  3645.  
  3646.   A few  notes about this  table.  Note  that /dev/fd0 corresponds  to
  3647. the first floppy drive (A:  under MS-DOS) and /dev/fd1 corresponds  to
  3648. the second floppy (B:).
  3649.   Also,  SCSI hard  drives are  named differently  than other  drives.
  3650. IDE, MFM, and RLL  drives are accessed  through the devices  /dev/hda,
  3651. /dev/hdb, and so on.  The individual partitions on  the drive /dev/hda
  3652. are /dev/hda1, /dev/hda2, and so on.   However, SCSI drives  are named
  3653. /dev/sda, /dev/sdb, etc., with  partition names such as /dev/sda1  and
  3654. /dev/sda2.
  3655.   Here's an  example.    Let's say  that you  have a  single IDE  hard
  3656. drive, with 3  primary partitions.   The first two  are set aside  for
  3657. MS-DOS, and  the third  is an  extended partition  which contains  two
  3658. logical partitions, both for use by  Linux.  The devices  referring to
  3659. these partitions would be:
  3660.    First MS-DOS partition (C:)     /dev/hda1
  3661.    Second MS-DOS partition (D:)    /dev/hda2
  3662.    Extended partition              /dev/hda3
  3663.    First Linux logical partition   /dev/hda5
  3664.    Second Linux logical partition  /dev/hda6
  3665.  
  3666.   Note  that  /dev/hda4 is  skipped;  it  corresponds  to  the  fourth
  3667. primary partition,  which we  don't have  in  this example.    Logical
  3668. 2.3.   Installing the Linux software                                60
  3669. _______________________________________________________________________
  3670.  
  3671. partitions are named consecutively starting with /dev/hda5.
  3672.  
  3673. 2.3.3 Creating Linux partitions
  3674.  
  3675. Now you are ready to  create Linux partitions with the  fdisk command.
  3676. As described in  Section 2.2.3,  in general  you will  need to  create
  3677. at least  one partition  for the  Linux software  itself, and  another
  3678. partition for swap space.
  3679.   After booting the installation media, run fdisk by typing
  3680.  
  3681.     fdisk <drive>
  3682.  
  3683. where <drive> is the  Linux device name  of the drive  you plan to add
  3684. partitions to (see Table 2.1).  For instance, if you want to run fdisk
  3685. on the first SCSI disk in your system, use the command fdisk /dev/sda.
  3686. /dev/hda (the first  IDE drive) is  the default  if you don't  specify
  3687. one.
  3688.   If you  are creating Linux  partitions on more  than one drive,  run
  3689. fdisk once for each drive.
  3690.  
  3691.     # fdisk /dev/hda
  3692.  
  3693.     Command (m for help):
  3694.  
  3695.  
  3696. Here fdisk is waiting for a command;  you can type m to get a  list of
  3697. options.
  3698.  
  3699.     Command (m for help):  m
  3700.     Command action
  3701.     a toggle a bootable flag
  3702.     d delete a partition
  3703.     l list known partition types
  3704.     m print this menu
  3705.     n add a new partition
  3706.     p print the partition table
  3707.     q quit without saving changes
  3708.     t change a partition's system id
  3709.     u change display/entry units
  3710.     v verify the partition table
  3711.     w write table to disk and exit
  3712.     x extra functionality (experts only)
  3713.  
  3714.     Command (m for help):
  3715.  
  3716. The n command is used  to create a new partition.   Most of  the other
  3717. options you won't need to worry  about.  To quit fdisk  without saving
  3718. any changes, use the q command.   To quit fdisk and write  the changes
  3719. to the partition table to disk, use the w command.
  3720.   The first  thing you  should do  is display  your current  partition
  3721. table and write the information down, for later reference.   Use the p
  3722. 2.3.   Installing the Linux software                                61
  3723. _______________________________________________________________________
  3724.  
  3725. command.
  3726.  
  3727.     Command (m for help):  p
  3728.     Disk /dev/hda:  16 heads, 38 sectors, 683 cylinders
  3729.     Units = cylinders of 608 * 512 bytes
  3730.  
  3731.  
  3732.        Device Boot  Begin   Start     End  Blocks   Id  System
  3733.     /dev/hda1   *         1        1      203    61693     6  DOS  16-
  3734.     bit >=32M
  3735.  
  3736.  
  3737.  
  3738.     Command (m for help):
  3739.  
  3740. In this  example, we  have  a single  MS-DOS  partition on  /dev/hda1,
  3741. which is 61693 blocks  (about 60 megs).(6)   This partition starts  at
  3742. cylinder number 1, and ends on cylinder  203.  We have a total  of 683
  3743. cylinders in this  disk;  so there are  480 cylinders  left to  create
  3744. Linux partitions on.
  3745.   To create  a new partition,  use the  n command.   In this  example,
  3746. we'll create  two primary  partitions  (/dev/hda2 and  /dev/hda3)  for
  3747. Linux.
  3748.  
  3749.     Command (m for help):  n
  3750.     Command action
  3751.     e extended
  3752.     p primary partition (1-4)
  3753.     p
  3754.  
  3755. Here, fdisk is asking the type  of the partition to create:   extended
  3756. or primary.  In our  example, we're creating only  primary partitions,
  3757. so we choose p.
  3758.  
  3759.     Partition number (1-4):
  3760.  
  3761. fdisk will then ask for the  number of the partition to create;  since
  3762. partition 1 is already used, our first Linux partition  will be number
  3763. 2.
  3764.  
  3765.     Partition number (1-4):  2
  3766.     First cylinder (204-683):
  3767.  
  3768. Now enter  the starting  cylinder  number of  the  partition.    Since
  3769. cylinders 204 through 683  are unused, we'll  use the first  available
  3770. one (numbered 204).   There's no reason  to leave empty space  between
  3771. partitions.
  3772.  
  3773. ----------------------------
  3774.  6. A block, under Linux, is 1024 bytes.
  3775. 2.3.   Installing the Linux software                                62
  3776. _______________________________________________________________________
  3777.  
  3778.     First cylinder (204-683):  204
  3779.     Last cylinder or +size or +sizeM or +sizeK (204-683):
  3780.  
  3781. fdisk is  asking  for  the size  of  the  partition  to create.     We
  3782. can either specify  an ending  cylinder number,  or a  size in  bytes,
  3783. kilobytes, or megabytes.  Since we want our partition to be 80 megs in
  3784. size, we specify +80M. When  specifying a partition size in  this way,
  3785. fdisk will round the  actual partition size  to the nearest number  of
  3786. cylinders.
  3787.  
  3788.     Last cylinder or +size or +sizeM or +sizeK (204-683):  +80M
  3789.  
  3790.     Warning:  Linux  cannot currently  use 33090  sectors of  this
  3791.     partition
  3792.  
  3793. If you see a warning message such  as this, it can be ignored.   fdisk
  3794. prints the warning  because it's  an older program,  and dates  before
  3795. the time  that Linux  partitions were  allowed to  be  larger than  64
  3796. megabytes.
  3797.   Now we're ready to create  our second Linux partition.  For  sake of
  3798. demonstration, we'll create it with a size of 10 megabytes.
  3799.  
  3800.     Command (m for help):  n
  3801.     Command action
  3802.     e extended
  3803.     p primary partition (1-4)
  3804.     p
  3805.     Partition number (1-4):  3
  3806.     First cylinder (474-683):  474
  3807.     Last cylinder or +size or +sizeM or +sizeK (474-683):  +10M
  3808.  
  3809.   At last,  we'll  display the  partition table.    Again, write  down
  3810. all of  this  information---especially the  block  sizes of  your  new
  3811. partitions.    You'll  need  to  know  the  sizes  of  the  partitions
  3812. when creating filesystems,  later.   Also,  verify that  none of  your
  3813. partitions overlap.
  3814.  
  3815.     Command (m for help):  p
  3816.  
  3817.     Disk /dev/hda:  16 heads, 38 sectors, 683 cylinders
  3818.     Units = cylinders of 608 * 512 bytes
  3819.  
  3820.  
  3821.        Device Boot  Begin   Start     End  Blocks   Id  System
  3822.     /dev/hda1   *         1        1      203    61693     6  DOS  16-
  3823.     bit >=32M
  3824.     /dev/hda2         204     204     473   82080   81  Linux/MINIX
  3825.     /dev/hda3         474     474     507   10336   81  Linux/MINIX
  3826. 2.3.   Installing the Linux software                                63
  3827. _______________________________________________________________________
  3828.  
  3829. As you can  see, /dev/hda2  is now  a partition of  size 82080  blocks
  3830. (which corresponds  to about  80 megabytes),  and  /dev/hda3 is  10336
  3831. blocks (about 10 megs).
  3832.   Note that many distributions (such as Slackware) require  you to use
  3833. the t command in  fdisk to change  the type of  the swap partition  to
  3834. ``Linux swap'',  which is usually  numbered 82.    You can  use the  L
  3835. command to print a  list of known partition  type codes, and then  use
  3836. t to set the type of  the swap partition to that which  corresponds to
  3837. ``Linux swap''.
  3838.   In  this   way,   the  installation   software  will   be  able   to
  3839. automatically find  your  swap partitions  based  on  type.    If  the
  3840. installation software doesn't seem  to recognize your swap  partition,
  3841. you might want to re-run fdisk and use the t command  on the partition
  3842. in question.
  3843.   In the example above, the remaining cylinders on  the disk (numbered
  3844. 508 to 683) are  unused.  You  may wish to  leave unused space on  the
  3845. disk, in case you wish to create additional partitions later.
  3846.   Finally, we use the w command to write the changes  to disk and exit
  3847. fdisk.
  3848.  
  3849.     Command (m for help):  w
  3850.  
  3851.     #
  3852.  
  3853.   Keep in mind that  none of the changes you make while  running fdisk
  3854. will take effect until  you give the  w command, so  you can toy  with
  3855. different configurations and save them when you're done.  Also, if you
  3856. want to quit fdisk at any  time without saving the changes, use  the q
  3857. command.  Remember that you shouldn't modify partitions  for operating
  3858. systems other than Linux with the Linux fdisk program.
  3859.   Remember that  you may not  be able to boot  Linux from a  partition
  3860. using cylinders numbered  over 1023.    Therefore, you  should try  to
  3861. create your Linux root partition  within the sub-1024 cylinder  range.
  3862. Again, if this is impossible, you can simply boot Linux from floppy.
  3863.   Some Linux  distributions  require you  to reboot  the system  after
  3864. running fdisk.  This  is to allow the  changes to the partition  table
  3865. to take effect  before installing  the software.    Newer versions  of
  3866. fdisk automatically update the partition information in the kernel, so
  3867. rebooting isn't necessary.    To be on  the safe  side, after  running
  3868. fdisk you  should reboot  the installation  media, as  before,  before
  3869. proceeding.
  3870.  
  3871. 2.3.4 Creating the swap space
  3872.  
  3873. If you are planning  to use a swap  partition for virtual RAM,  you're
  3874. ready to prepare  it for use.(7)   In  Chapter 4  we will discuss  the
  3875.  
  3876. ----------------------------
  3877.  7. Again, some  distributions of  Linux will prepare  the swap  space
  3878. automatically for you, or via an installation menu option.
  3879. 2.3.   Installing the Linux software                                64
  3880. _______________________________________________________________________
  3881.  
  3882. preparation of a swap file in case you don't want to use an individual
  3883. partition.
  3884.   Many distributions  require you  to create and  activate swap  space
  3885. before installing  the  software.    If you  have  a small  amount  of
  3886. physical RAM, the installation procedure may not be  successful unless
  3887. you have some amount of swap space enabled.
  3888.   The  Slackware  distribution requires  you  to  create  swap  space,
  3889. before installation, if you have 4 megabytes of RAM or less.   If this
  3890. is not the case, the  Slackware installation procedure can be  used to
  3891. prepare swap space automatically.   If in  doubt, go ahead and  follow
  3892. the procedure described here; it can't hurt.
  3893.   The command  used to  prepare  a swap  partition is  mkswap, and  it
  3894. takes the form
  3895.  
  3896.     mkswap -c <partition> <size>
  3897.  
  3898. where <partition> is the name of the swap  partition, and <size> is the
  3899. size of  the partition,  in  blocks.(8)   For  example,  if your  swap
  3900. partition is /dev/hda3 and is 10336 blocks in size, use the command
  3901.  
  3902.     # mkswap --c /dev/hda3 10336
  3903.  
  3904. The -c option tells  mkswap to check for  bad blocks on the  partition
  3905. when creating the swap space.
  3906.   If you are using multiple swap partitions, you  will need to execute
  3907. the appropriate mkswap command for each partition.
  3908.   After formatting the  swap space, you need  to enable it for use  by
  3909. the system.  Usually,  the system automatically enables swap  space at
  3910. boot time.   However,  because you  have not yet  installed the  Linux
  3911. software, you need to enable it by hand.
  3912.   The command to enable swap space is swapon, and it takes the form
  3913.  
  3914.     swapon <partition>
  3915.  
  3916. In the example above,  to enable the swap  space on /dev/hda3, we  use
  3917. the command
  3918.  
  3919.     # swapon /dev/hda3
  3920.  
  3921.  
  3922. 2.3.5 Creating the filesystems
  3923.  
  3924. Before you can  use your  Linux partitions  to store  files, you  must
  3925. create filesystems on  them.   Creating a  filesystem is analogous  to
  3926. formatting a partition under  MS-DOS or other  operating systems.   We
  3927. discussed filesystems briefly in Section 2.2.3.
  3928.  
  3929. ----------------------------
  3930.  8. This is the size as reported by fdisk, using the p menu option.  A
  3931. block under Linux is 1024 bytes.
  3932. 2.3.   Installing the Linux software                                65
  3933. _______________________________________________________________________
  3934.  
  3935.   There are several  types of filesystems available  for Linux.   Each
  3936. filesystem type has its  own format and  set of characteristics  (such
  3937. as filename  length,  maximum file  size,  and so  on).    Linux  also
  3938. supports several ``third-party'' filesystem  types such as the  MS-DOS
  3939. filesystem.
  3940.   The  most commonly  used  filesystem  type is  the  Second  Extended
  3941. Filesystem, or ext2fs.   The ext2fs is  one of the most efficient  and
  3942. flexible filesystems;  it allows filenames  up to  256 characters  and
  3943. filesystem sizes of up to  4 terabytes.   In Chapter 4, we'll  discuss
  3944. the various filesystem types available for Linux.  Initially, however,
  3945. we suggest that you use the ext2fs filesystem.
  3946.   If you  are installing the  Slackware distribution, filesystems  are
  3947. created automatically for you by the installation  procedure described
  3948. in the next section.  If you wish to create your  filesystems by hand,
  3949. however, follow the procedure described here.
  3950.   To create an ext2fs filesystem, use the command
  3951.  
  3952.     mke2fs -c <partition> <size>
  3953.  
  3954. where <partition> is the name of the partition,  and <size> is the size
  3955. of the partition  in blocks.   For  example, to  create a  82080-block
  3956. filesystem on /dev/hda2, use the command
  3957.  
  3958.     # mke2fs --c /dev/hda2 82080
  3959.  
  3960.   If you're using multiple  filesystems for Linux, you'll need  to use
  3961. the appropriate mke2fs command for each filesystem.
  3962.   If you have encountered any problems at this point,  see Section 2.5
  3963. at the end of this chapter.
  3964.  
  3965. 2.3.6 Installing the software
  3966.  
  3967. Finally,  you are  ready  to  install  the software  on  your  system.
  3968. Every distribution has  a different mechanism  for doing  this.   Many
  3969. distributions have  a  self-contained  program  which  will  step  you
  3970. through the installation.   On other  distributions, you will have  to
  3971. mount your filesystems in  a certain subdirectory  (such as /mnt)  and
  3972. copy the software to them by  hand.  On CD-ROM distributions,  you may
  3973. be given the option to install a portion of the software  on your hard
  3974. drives, and leave most of the software on the CD-ROM.
  3975.   Some  distributions offer  several  different  ways to  install  the
  3976. software.   For  example,  you may  be able  to  install the  software
  3977. directly from an MS-DOS partition on your hard drive,  instead of from
  3978. floppies.  Or, you  may be able to  install over a TCP/IP network  via
  3979. FTP or NFS. See your distribution's documentation for details.
  3980.   For example, the Slackware distribution only requires  you to create
  3981. partitions with fdisk,  optionally create swap  space with mkswap  and
  3982. swapon (if you have  4 megs or  less of RAM),  and then run the  setup
  3983. program.  setup leads you through a very self-explanatory  menu system
  3984. to install the software.  Use of setup is described in detail below.
  3985. 2.3.   Installing the Linux software                                66
  3986. _______________________________________________________________________
  3987.  
  3988.   The exact method used to install the Linux  software differs greatly
  3989. with each  distribution.    We're  hoping  that installing  the  Linux
  3990. software should be self-explanatory, as it is with most distributions.
  3991.  
  3992. 2.3.6.1 Installing Slackware with setup
  3993.  
  3994. If you  are  installing  Slackware,  after  creating  partitions  (and
  3995. possibly swap space), use the command
  3996.  
  3997.     # setup
  3998.  
  3999. This will present you will a menu-based procedure to walk  you through
  4000. the remaining steps of installation.
  4001.   The  procedure described  here  corresponds  to that  found  on  the
  4002. color144 and  colrlite  root disks;  the  other  root disks  may  have
  4003. slightly different procedures.
  4004.   The setup menu consists of the following items.   Use the arrow keys
  4005. to move over the items, and  press [enter] or [spacebar] to  select an
  4006. item.
  4007.  
  4008. Help       View the setup help file.
  4009.  
  4010. Keymap     This option allows you to specify  the keyboard mapping for
  4011.            your  system if you  do not  have a  US keyboard.   A  list
  4012.            of keymaps  will be presented; select the  appropriate item
  4013.            from the list.
  4014. Quick      This   allows  you   to   select  between   ``quick''   and
  4015.            ``verbose''  installation  modes.      ``Verbose''  is  the
  4016.            default, and is recommended  for most installations (unless
  4017.            you've  installed Slackware a  dozen times,  in which  case
  4018.            you already know this).
  4019.  
  4020. Make tags  This  allows  Slackware  installation   experts  to  create
  4021.            customized ``tag  files'' for preselecting packages.   This
  4022.            is   only  necessary  for   customizing  the   installation
  4023.            procedure  in  some  way;  you shouldn't  have  to  concern
  4024.            yourself with this.
  4025.  
  4026. Addswap    This will be the first item that  most users will select to
  4027.            install  Slackware.   A list  of available swap  partitions
  4028.            will  be  displayed  (those partitions  with  type  ``Linux
  4029.            swap''  as set  in fdisk).   You  will be  able to  specify
  4030.            which  partitions you  wish to  use for  swap space.    You
  4031.            will  then be  asked if  you wish  to run  mkswap on  these
  4032.            partitions.
  4033.  
  4034.            If  you  have  already  executed   mkswap  and  swapon  (as
  4035.            described in  Section 2.3.4) on your swap partitions,  then
  4036.            you  should not  allow  setup to  execute mkswap  on  these
  4037.            partitions.
  4038.    2.3.   Installing the Linux software                                67
  4039.    _______________________________________________________________________
  4040.  
  4041.               Even if you have already executed  mkswap and swapon, it is
  4042.               necessary to use the Addswap menu  item:  This ensures that
  4043.               your swap  partitions will be  available once you have  the
  4044.               system installed.
  4045.  
  4046. !             Be  warned!    Creating  swap  space on  a  partition  will
  4047.               destroy data  on that partition.   Be sure that you're  not
  4048.               wiping out data that you want to keep.
  4049.               If  you select this  menu item,  you will be  automatically
  4050.               prompted if  you wish to proceed with the  following items.
  4051.               In general, you should do this.
  4052.  
  4053.    Target     This item  allows you to specify the partitions  upon which
  4054.               Linux is to  be installed.  A list of  available partitions
  4055.               (those with  type ``Linux native'', as specified  by fdisk)
  4056.               will be displayed, and you will be  asked to enter the name
  4057.               of  your Linux  root partition,  such  as /dev/hda2.    You
  4058.               will then  be prompted for the type of filesystem  that you
  4059.               wish  to create;  we  suggest using  the ext2fs  filesystem
  4060.               type  as described in Section  2.3.5.   This will create  a
  4061.               filesystem on  the named partition---somewhat analogous  to
  4062.               ``formatting'' the partition under MS-DOS.
  4063.               You  will also be  prompted for  any other partitions  that
  4064.               you  might wish  to use for  Linux.   For  example, if  you
  4065.               created a separate partition for  /usr (see Section 2.2.3),
  4066.               you will be  able to specify the name of the  partition and
  4067.               the  location where  it should be  mounted (as  in /usr  or
  4068.               /usr/bin).
  4069.  
  4070. !             Be  warned!   Creating  a  filesystem on  a partition  will
  4071.               destroy all  data on that partition.   Be sure that  you're
  4072.               not wiping out data that you want to keep.
  4073.               Even if  you already created your filesystems  using mke2fs
  4074.               (see Section 2.3.5),  you must use the Target menu  item to
  4075.               specify the partitions where Linux will be installed.
  4076.  
  4077.    Source     This  menu item  allows you to  specify where  you will  be
  4078.               installing Slackware  from, such as floppy, hard  drive, or
  4079.               CD-ROM.
  4080.               If you  are installing from hard  drive, you will be  asked
  4081.               what partition  the Slackware files  are found on, as  well
  4082.               as the  type of partition.   For  example, if you have  the
  4083.               Slackware files  on an MS-DOS partition, enter the  name of
  4084.               the  partition (such  as /dev/hda1) and  select MS-DOS  FAT
  4085.               as the  type.   You will then  be asked what directory  the
  4086.               files may be  found under on this partition.   For example,
  4087.               if you have the Slackware files  stored under the directory
  4088.               C:\SLACK on your MS-DOS partition, enter
  4089. 2.3.   Installing the Linux software                                68
  4090. _______________________________________________________________________
  4091.  
  4092.                /slack
  4093.  
  4094.  
  4095.            as  the  location.    Note  that  you  should  use  forward
  4096.            slashes, not backslashes, in the pathname.
  4097.            If you  are installing from CD-ROM,  you will be asked  the
  4098.            type  of CD-ROM  device  that you  are  using, as  well  as
  4099.            what  directory on the  CD-ROM the files  may be found  in.
  4100.            Many CD-ROMs have the files  contained within the directory
  4101.            /slakware, but this depends on the release.
  4102.            If  you  are  installing  Slackware  Professional,(9)   two
  4103.            directories are  used on the  CD-ROM. slakware is used  for
  4104.            the standard  system which will install the  files directly
  4105.            to your hard drive.  slackpro  is used for the CD-ROM-based
  4106.            system  where many  files are  accessed  directly from  the
  4107.            CD-ROM. This  can save diskspace, but accessing  many files
  4108.            is  also  noticeably  slower.     Several  other  Slackware
  4109.            vendors provide  the ability to  run the software from  the
  4110.            CD-ROM  as well.   However,  if you  have the diskspace  to
  4111.            spare, we  recommend not running Slackware from  the CD-ROM
  4112.            itself.  Performance is generally slower.
  4113.  
  4114.            If  you are  attempting  a hard  drive or  CD-ROM  install,
  4115.            Slackware  may  report  that  there is  a  mount  error  at
  4116.            this  point.   This  is  usually an  indication that  there
  4117.            was  a problem  accessing  the hard  drive or  CD-ROM.  See
  4118.            Section  2.5.3 for  more  information if  you see  such  an
  4119.            error message.
  4120.  
  4121. Disk sets  This menu  option allows you to  select the disk sets  that
  4122.            you wish to install.  You must  install at least the A disk
  4123.            set.   Simply  use the  arrow keys and  spacebar to  select
  4124.            which disk sets you wish to install.
  4125.            Note  that selecting a  particular disk  set does not  mean
  4126.            that all  packages on the disk  set will be installed;  you
  4127.            will  be prompted  before installing packages  on the  disk
  4128.            set marked as ``optional'' or ``recommended.''
  4129.  
  4130. Install    At  long last,  this menu  item will  install the  software
  4131.            on  your system.   You will be  prompted for the  prompting
  4132.            method;  most users  should select  ``normal.''   For  each
  4133.            disk set that you selected,  the ``required'' packages will
  4134.            be installed, and you will be  prompted when installing the
  4135.            ``optional''  and ``recommended''  packages.    If you  are
  4136.            installing  from floppy you  will be  asked to insert  each
  4137.            floppy in succession.
  4138.  
  4139. ----------------------------
  4140.  9. Slackware Professional  is a version  of Slackware available  from
  4141. Morse Telecommunications.
  4142. 2.3.   Installing the Linux software                                69
  4143. _______________________________________________________________________
  4144.  
  4145.            As each  package is installed  a short description will  be
  4146.            printed.    Unless you have  background in  UNIX or  Linux,
  4147.            many  of these  descriptions  will not  mean much  to  you.
  4148.            Take  note of which  packages are being  installed, so  you
  4149.            know  what's there,  but don't  worry about  trying to  jot
  4150.            down everything that's printed on the display.
  4151.  
  4152.            The  most common  error  encountered here  is that  a  file
  4153.            cannot  be  found  on  a  floppy,  or  an  I/O  error  when
  4154.            attempting  to  read  the  floppy.      The  former  is  an
  4155.            indication  that   the  files  on  your  floppy   might  be
  4156.            corrupted  or  incomplete;   the  latter  that  the  floppy
  4157.            itself  is  bad.   Any  floppies  which give  these  errors
  4158.            should  be replaced,  and  you should  re-install the  disk
  4159.            set  containing those  floppies.    See Section  2.5.3  for
  4160.            suggestions.
  4161.            You  may also have  read errors  when attempting to  access
  4162.            a  CD-ROM;  be  sure  that the  CD-ROM  is  clean,  has  no
  4163.            fingerprints, etc.
  4164.  
  4165. Configure  This menu  item performs some post-installation  configura-
  4166.            tion  of your system.    This is covered  in the  following
  4167.            section.
  4168.  
  4169.  
  4170. 2.3.7 Creating the boot floppy or installing LILO
  4171.  
  4172. Every distribution  provides  some means  of  booting your  new  Linux
  4173. system after you  have installed  the software.   In  many cases,  the
  4174. installation procedure will create a ``boot floppy'' which  contains a
  4175. Linux kernel configured to use your newly-created root filesystem.  In
  4176. order to boot  Linux, you  would boot  from this  floppy, and  control
  4177. would be  transferred to  your hard  drive after  booting.   On  other
  4178. distributions, this ``boot floppy'' is the installation floppy itself.
  4179.   Many distributions give  you the option  of installing LILO on  your
  4180. hard drive.   LILO  is a  program that  is installed  on your  drive's
  4181. master boot record.  It is able to boot a number of operating systems,
  4182. including MS-DOS and Linux, and  allows you to select at  startup time
  4183. which to boot.
  4184.   For the  Slackware distribution,  the  Configure item  in the  setup
  4185. menu will allow you to create  a boot floppy as well as  install LILO.
  4186. These options should be fairly  self-explanatory.  The Configure  menu
  4187. item also  allows  you to  specify  your modem,  mouse,  and  timezone
  4188. information.
  4189.   In  order  for  LILO to  be  installed  successfully,  it  needs  to
  4190. know a good deal of  information about your drive  configuration---for
  4191. example, which  partitions contain  which  operating systems,  how  to
  4192. boot each  operating system,  and so  on.    Many distributions,  when
  4193. installing LILO, attempt  to ``guess''  at the appropriate  parameters
  4194. for your configuration.  Although  it's not often, the  automated LILO
  4195. installation provided by some distributions  can fail, and leave  your
  4196. 2.4.   Postinstallation procedures                                  70
  4197. _______________________________________________________________________
  4198.  
  4199. master boot record in shambles  (although it's very doubtful that  any
  4200. damage to the actual  data on your  hard drive will  take place).   In
  4201. particular, if you  use OS/2's  Boot Manager,  you should not  install
  4202. LILO using the  automated procedure---there  are special  instructions
  4203. for using LILO with the Boot Manager, which will be covered later.
  4204.   In many  cases, it  is best  to use a  boot floppy,  until you  have
  4205. a chance  to configure  LILO yourself,  by hand.    If you're  feeling
  4206. exceptionally trustworthy, though, you can go ahead with the automated
  4207. LILO installation if it is provided with your distribution.
  4208.   In Chapter  4, we'll cover  in detail how  to configure and  install
  4209. LILO for your particular setup.
  4210.   If  everything goes  well,  then congratulations!    You  have  just
  4211. installed  Linux  on  your   system.     Go   have  a  Diet  Coke   or
  4212. something---you deserve it.
  4213.   In  case you  did  run  into  any trouble,  the  next  section  will
  4214. describe the most common sticking points for Linux  installations, and
  4215. how to get around them.
  4216.  
  4217. 2.3.8 Additional installation procedures
  4218.  
  4219. Some  distributions   of  Linux   provide  a   number  of   additional
  4220. installation procedures, allowing  you to  configure various  software
  4221. packages such  as  TCP/IP networking,  the  X Window  System,  and  so
  4222. on.   If  you are  provided with  these  configuration options  during
  4223. installation, you  may  wish  to read  ahead  in  this book  for  more
  4224. information on how to configure this software.  Otherwise,  you should
  4225. put off  these  installation  procedures  until you  have  a  complete
  4226. understanding of how to configure the software.
  4227.   It's up  to  you; if  all  else fails,  just go  with  the flow  and
  4228. see what  happens.    It's very  doubtful that  anything  that you  do
  4229. incorrectly now cannot be undone in the future.  (Knock on wood.)
  4230.  
  4231.  
  4232. 2.4 Postinstallation procedures
  4233.  
  4234. After you have completed installing  the Linux software, there  should
  4235. be very little left to do before you can begin to use the system.   In
  4236. most cases, you should  be able to reboot  the system, login as  root,
  4237. and begin exploring  the system.   (Each  distribution has a  slightly
  4238. different method for doing this.)
  4239.   At  this point  it's  a  good idea  to  explain  how to  reboot  and
  4240. shutdown the  system as  you're using  it.   You  should never  reboot
  4241. or shutdown your  Linux system by  pressing the  reset switch or  with
  4242. the old ``Vulcan Nerve  Pinch''---that is, by pressing  [ctrl-alt-del]
  4243. in unison.(10)   You shouldn't  simply switch  off the power,  either.
  4244.  
  4245. ----------------------------
  4246. 10. On  most Linux  systems, however,  [ctrl-alt-del]  will cause  the
  4247. system to  shutdown  gracefully,  as  if  you had  used  the  shutdown
  4248. command.
  4249. 2.5.   Running Into Trouble                                         71
  4250. _______________________________________________________________________
  4251.  
  4252. As with  most  UNIX  systems,  Linux  caches disk  writes  in  memory.
  4253. Therefore, if  you suddenly reboot  the system  without shutting  down
  4254. ``cleanly'', you can corrupt the  data on your drives,  causing untold
  4255. damage.
  4256.   The  easiest way  to  shut down  the  system  is with  the  shutdown
  4257. command.     As  an  example,  to  shutdown  and   reboot  the  system
  4258. immediately, use the following command as root:
  4259.  
  4260.     # shutdown --r now
  4261.  
  4262. This will  cleanly reboot  your system.    The man  page for  shutdown
  4263. describes the other command-line arguments that are available.(11)
  4264.   Note,  however, that  many Linux  distributions do  not provide  the
  4265. shutdown command on the installation media.  This means that the first
  4266. time you reboot your  system after installation,  you may need to  use
  4267. the [ctrl-alt-del]  combination after  all.   Thereafter,  you  should
  4268. always use the shutdown command.
  4269.   After you  have a chance to  explore and use  the system, there  are
  4270. several configuration chores that you should undertake.  The  first is
  4271. to create a user account for yourself (and, optionally,  for any other
  4272. users that might have access to  the system).  Creating  user accounts
  4273. is described in  Section 4.4.   Usually,  all that you  have to do  is
  4274. login as root, and run the adduser (sometimes useradd) program.   This
  4275. will lead you through several prompts to create a new user account.
  4276.   If you  created more  than one filesystem  for Linux,  or if  you're
  4277. using a  swap partition,  you may  need  to edit  the file  /etc/fstab
  4278. in order for  those filesystems  to be  available automatically  after
  4279. rebooting.  (For  example, if you're  using a separate filesystem  for
  4280. /usr, and  none of  the files  that should  be  in /usr  appear to  be
  4281. present, you may simply need to  mount that filesystem.)   Section 4.8
  4282. describes this procedure.    Note that the  Slackware distribution  of
  4283. Linux automatically  configures your  filesystems  and swap  space  at
  4284. installation time, so this usually isn't necessary.
  4285.  
  4286.  
  4287. 2.5 Running Into Trouble
  4288.  
  4289. Almost everyone runs into some kind of snag or hangup  when attempting
  4290. to install Linux the  first time.   Most of the  time, the problem  is
  4291. caused by a simple  misunderstanding.  Sometimes,  however, it can  be
  4292. something more serious, such as an oversight by one of the developers,
  4293. or a bug.
  4294.   This section  will  describe some  of the  most common  installation
  4295. problems, and how  to solve  them.   If your  installation appears  to
  4296. be successful, but you  received unexpected error messages during  the
  4297. installation, these are described here as well.
  4298. ----------------------------
  4299. 11. Use the command man shutdown to see the manual page for shutdown.
  4300. 2.5.   Running Into Trouble                                         72
  4301. _______________________________________________________________________
  4302.  
  4303. 2.5.1 Problems with booting the installation media
  4304.  
  4305. When attempting to  boot the  installation media for  the first  time,
  4306. you may  encounter a  number of  problems.   These  are listed  below.
  4307. Note that  the following  problems  are not  related to  booting  your
  4308. newly-installed Linux system.   See Section  2.5.4 for information  on
  4309. these kinds of pitfalls.
  4310.  
  4311.  o  Floppy or media error when attempting to boot.
  4312.  
  4313.     The most popular cause for this kind of problem is  a corrupt boot
  4314.     floppy.  Either  the floppy is  physically damaged, in which  case
  4315.     you should re-create the disk with a brand new floppy, or the data
  4316.     on the floppy  is bad, in  which case you  should verify that  you
  4317.     downloaded and transferred the data  to the floppy correctly.   In
  4318.     many cases,  simply re-creating the  boot floppy  will solve  your
  4319.     problems.  Retrace your steps and try again.
  4320.  
  4321.     If you  received  your  boot  floppy  from  a  mail  order  vendor
  4322.     or some  other distributor,  instead of  downloading and  creating
  4323.     it yourself,  contact  the  distributor and  ask  for a  new  boot
  4324.     floppy---but only after verifying that this is indeed the problem.
  4325.  
  4326.  o  System ``hangs'' during boot or after booting.
  4327.  
  4328.     After the  installation media  boots,  you will  see  a number  of
  4329.     messages from  the kernel  itself, indicating  which devices  were
  4330.     detected and  configured.     After  this,  you  will  usually  be
  4331.     presented with  a  login  prompt,  allowing you  to  proceed  with
  4332.     installation (some distributions  instead drop  you right into  an
  4333.     installation program of  some kind).    The system  may appear  to
  4334.     ``hang'' during  several of  these steps.    During  all of  these
  4335.     steps, be patient; loading software from floppy is very slow.   In
  4336.     many cases, the system has not hung at all, but is merely taking a
  4337.     long time.  Verify that  there is no drive or system  activity for
  4338.     at least several minutes before assuming that the system is hung.
  4339.  
  4340.  
  4341.     1.  After booting from the LILO  prompt, the system must  load the
  4342.         kernel image from floppy.  This may take several  seconds; you
  4343.         will know that things are going well if the floppy drive light
  4344.         is still on.
  4345.  
  4346.     2.  While the kernel boots, SCSI  devices must be probed for.   If
  4347.         you do not  have any SCSI devices  installed, the system  will
  4348.         ``hang'' for up to 15 seconds while the SCSI  probe continues;
  4349.         this usually occurs after the line
  4350.  
  4351.  
  4352.             lp_init:  lp1 exists (0), using polling driver
  4353. 2.5.   Running Into Trouble                                         73
  4354. _______________________________________________________________________
  4355.  
  4356.         appears on your screen.
  4357.  
  4358.     3.  After the kernel is  finished booting, control is  transferred
  4359.         to the  system bootup  files  on the  floppy.    Finally,  you
  4360.         will be  presented with  a login  prompt, or  be dropped  into
  4361.         an installation program.   If you  are presented with a  login
  4362.         prompt such as
  4363.  
  4364.  
  4365.             Linux login:
  4366.  
  4367.  
  4368.         you should  then  login  (usually as  root  or  install---this
  4369.         varies with each distribution).  After entering  the username,
  4370.         the  system may  pause  for  20  seconds  or  more  while  the
  4371.         installation program  or shell  is being  loaded from  floppy.
  4372.         Again, the floppy drive light should be on.  Don't assume that
  4373.         the system is hung.
  4374.  
  4375.  
  4376.     Any of  the  above  items  may  be the  source  of  your  problem.
  4377.     However, it  is possible  that the  system  actually may  ``hang''
  4378.     while booting, which can be due to several causes.   First of all,
  4379.     you may not  have enough  available RAM to  boot the  installation
  4380.     media.  (See the  following item for information on  disabling the
  4381.     ramdisk to free up memory.)
  4382.  
  4383.     The cause  of  many  system  hangs  is  hardware  incompatibility.
  4384.     Section 1.8 in the last chapter presented an overview of supported
  4385.     hardware under Linux.  Even if your hardware is supported, you may
  4386.     run into problems with incompatible hardware  configurations which
  4387.     are causing the system to hang.   See Section 2.5.2, below,  for a
  4388.     discussion of hardware incompatibilities.
  4389.  
  4390.  o  System reports out  of memory errors while  attempting to boot  or
  4391.     install the software.
  4392.  
  4393.     This item deals with  the amount of  RAM that you have  available.
  4394.     On systems  with 4  megabytes of  RAM or  less, you  may run  into
  4395.     trouble booting the installation media or installing  the software
  4396.     itself.   This is  because many distributions  use a  ``ramdisk'',
  4397.     which is a  filesystem loaded  directly into  RAM, for  operations
  4398.     while using  the installation  media.   The  entire  image of  the
  4399.     installation boot  floppy,  for  example,  may be  loaded  into  a
  4400.     ramdisk, which may require more than a megabyte of RAM.
  4401.  
  4402.     The solution  to this  problem is  to disable  the ramdisk  option
  4403.     when booting the  install media.    Each release  has a  different
  4404.     procedure for doing  this; on  the SLS release,  for example,  you
  4405.     type ``floppy'' at the LILO prompt when booting the a1 disk.   See
  4406. 2.5.   Running Into Trouble                                         74
  4407. _______________________________________________________________________
  4408.  
  4409.     your distribution's documentation for details.
  4410.  
  4411.     You may not  see an  ``out of  memory'' error  when attempting  to
  4412.     boot or install the software; instead, the system may unexpectedly
  4413.     hang, or fail  to boot.   If your  system hangs,  and none of  the
  4414.     explanations in the  previous section  seem to be  the cause,  try
  4415.     disabling the ramdisk.
  4416.  
  4417.     Keep in mind that  Linux itself requires  at least 2 megabytes  of
  4418.     RAM to run at all; some distributions of Linux require 4 megabytes
  4419.     or more.
  4420.  
  4421.  o  The system  reports  an error  such  as ``permission  denied''  or
  4422.     ``file not found'' while booting.
  4423.  
  4424.     This is  an  indication that  your  installation bootup  media  is
  4425.     corrupt.  If you attempt to boot from the  installation media (and
  4426.     you're sure that  you're doing everything  correctly), you  should
  4427.     not see any errors such as this.  Contact the  distributor of your
  4428.     Linux software and find out about the problem, and  perhaps obtain
  4429.     another copy of the  boot media if necessary.   If you  downloaded
  4430.     the bootup disk yourself, try re-creating the bootup disk, and see
  4431.     if this solves your problem.
  4432.  
  4433.  o  The system reports  the error ``VFS: Unable  to mount root''  when
  4434.     booting.
  4435.  
  4436.     This error message  means that the root  filesystem (found on  the
  4437.     boot media itself), could  not be found.   This means that  either
  4438.     your boot  media is  corrupt in  some  way, or  that  you are  not
  4439.     booting the system correctly.
  4440.  
  4441.     For example, many CD-ROM  distributions require that you have  the
  4442.     CD-ROM in the drive  when booting.   Also be sure that the  CD-ROM
  4443.     drive is on, and check for any activity.  It's  also possible that
  4444.     the system is  not locating your  CD-ROM drive at  boot time;  see
  4445.     Section 2.5.2 for more information.
  4446.  
  4447.     If you're sure  that you  are booting the  system correctly,  then
  4448.     your bootup media may indeed be corrupt.  This is  a very uncommon
  4449.     problem, so try other  solutions before attempting to use  another
  4450.     boot floppy or tape.
  4451.  
  4452.  
  4453. 2.5.2 Hardware problems
  4454.  
  4455. The most  common  form  of  problem  when  attempting  to  install  or
  4456. use Linux  is  an incompatibility  with  hardware.    Even if  all  of
  4457. your hardware is  supported by Linux,  a misconfiguration or  hardware
  4458. conflict can sometimes cause strange results---your devices may not be
  4459. 2.5.   Running Into Trouble                                         75
  4460. _______________________________________________________________________
  4461.  
  4462. detected at boot time, or the system may hang.
  4463.   It is important  to isolate these  hardware problems if you  suspect
  4464. that they  may be  the  source of  your  trouble.   In  the  following
  4465. sections we will  describe some  common hardware problems  and how  to
  4466. resolve them.
  4467.  
  4468. 2.5.2.1 Isolating hardware problems
  4469.  
  4470. If you experience a problem  that you believe to be  hardware-related,
  4471. the first  thing that  you  should to  do is  attempt  to isolate  the
  4472. problem.  This means eliminating all possible variables  and (usually)
  4473. taking the system apart, piece-by-piece, until the offending  piece of
  4474. hardware is isolated.
  4475.   This is not as frightening  as it may sound.  Basically,  you should
  4476. remove all nonessential hardware from your system, and  then determine
  4477. which device is actually causing the trouble---possibly by reinserting
  4478. each device, one at  a time.   This means  that you should remove  all
  4479. hardware other than the  floppy and video  controllers, and of  course
  4480. the keyboard.  Even innocent-looking devices such as mouse controllers
  4481. can wreak unknown havoc on your peace of mind unless you consider them
  4482. nonessential.
  4483.   For example,  let's say  that the system  hangs during the  Ethernet
  4484. board detection sequence  at boot time.    You might hypothesize  that
  4485. there is  a  conflict or  problem  with  the Ethernet  board  in  your
  4486. machine.  The quick and easy  way to find out is to pull  the Ethernet
  4487. board, and  try booting  again.   If  everything goes  well, then  you
  4488. know that either  (a) the  Ethernet board  is not  supported by  Linux
  4489. (see Section 1.8 for a list of compatible boards), or (b)  there is an
  4490. address or IRQ conflict with the board.
  4491.   ``Address or IRQ  conflict?''   What on earth does  that mean?   All
  4492. devices in your machine use an IRQ, or interrupt request line, to tell
  4493. the system that they  need something done  on their behalf.   You  can
  4494. think of the  IRQ as a  cord that the  device tugs  when it needs  the
  4495. system to take care of some pending request.  If more  than one device
  4496. is tugging on  the same  cord, the  kernel won't be  able to  detemine
  4497. which device it needs to service.  Instant mayhem.
  4498.   Therefore,  be sure that  all of  your installed  devices are  using
  4499. unique IRQ lines.    In general the  IRQ for  a device can  be set  by
  4500. jumpers on the card; see  the documentation for the  particular device
  4501. for details.  Some  devices do not require the  use of an IRQ  at all,
  4502. but it is  suggested that you  configure them to  use one if  possible
  4503. (the Seagate ST01 and ST02 SCSI controllers being good examples).
  4504.   In some  cases, the  kernel provided on  your installation media  is
  4505. configured to use  a certain IRQ  for certain devices.   For  example,
  4506. on some distributions  of Linux,  the kernel is  preconfigured to  use
  4507. IRQ 5 for the TMC-950 SCSI controller, the Mitsumi  CD-ROM controller,
  4508. and the bus mouse  driver.  If  you want to use  two or more of  these
  4509. devices, you'll need  to first install  Linux with  only one of  these
  4510. devices enabled,  then recompile  the kernel  in order  to change  the
  4511. default IRQ  for one  of them.    (See Chapter  4  for information  on
  4512. 2.5.   Running Into Trouble                                         76
  4513. _______________________________________________________________________
  4514.  
  4515. recompiling the kernel.)
  4516.   Another area where hardware conflicts can arise is  with DMA (direct
  4517. memory access) channels, I/O  addresses, and shared memory  addresses.
  4518. All of  these  terms  describe  mechanisms through  which  the  system
  4519. interfaces with hardware devices.  Some Ethernet boards,  for example,
  4520. use a shared memory address  as well as an  IRQ to interface with  the
  4521. system.  If any of these are in conflict with other  devices, then the
  4522. system may behave  unexpectedly.   You  should be able  to change  the
  4523. DMA channel, I/O or shared  memory addresses for your  various devices
  4524. with jumper settings.  (Unfortunately, some devices don't allow you to
  4525. change these settings.)
  4526.   The documentation for  your various hardware devices should  specify
  4527. the IRQ, DMA channel, I/O  address, or shared memory address  that the
  4528. devices use, and how to configure them.  Again, the simple  way to get
  4529. around these problems is just  to temporarily disable the  conflicting
  4530. devices until you have time to determine the cause of the problem.
  4531.   Table  2.2 is  a  list  of IRQ  and  DMA  channels used  by  various
  4532. ``standard'' devices found on most  systems.  Almost all  systems will
  4533. have some of these devices, so you should avoid setting the IRQ or DMA
  4534. of other devices in conflict with these values.
  4535.  
  4536.           Device                    I/Oaddress     IRQ   DMA
  4537.          
  4538.           ttyS0 (COM1)                 3f8          4    n/a
  4539.           ttyS1 (COM2)                 2f8          3    n/a
  4540.           ttyS2 (COM3)                 3e8          4    n/a
  4541.           ttyS3 (COM4)                 2e8          3    n/a
  4542.           lp0 (LPT1)                   378 - 37f    7    n/a
  4543.           lp1 (LPT2)                   278 - 27f    5    n/a
  4544.           fd0, fd1 (floppies 1 and 2)  3f0 - 3f7    6    2
  4545.           fd2, fd3 (floppies 3 and 4)  370 - 377    10   3
  4546.  
  4547.                   Table 2.2:  Common device settings
  4548.  
  4549.  
  4550.  
  4551. 2.5.2.2 Problems recognizing hard drive or controller
  4552.  
  4553. When Linux boots, you should see  a series of messages on  your screen
  4554. such as:
  4555.  
  4556.     Console:  colour EGA+ 80x25, 8 virtual consoles
  4557.     Serial driver version 3.96 with no serial options enabled
  4558.     tty00 at 0x03f8 (irq = 4) is a 16450
  4559.     tty03 at 0x02e8 (irq = 3) is a 16550A
  4560.     lp_init:  lp1 exists (0), using polling driver
  4561.     ...
  4562.  
  4563. Here, the kernel is detecting the various hardware devices  present on
  4564. your system.  At some point, you should see the line
  4565. 2.5.   Running Into Trouble                                         77
  4566. _______________________________________________________________________
  4567.  
  4568.     Partition check:
  4569.  
  4570. followed by a list of recognized partitions, for example:
  4571.  
  4572.     Partition check:
  4573.     hda:  hda1 hda2
  4574.     hdb:  hdb1 hdb2 hdb3
  4575.  
  4576. If, for some  reason, your  drives or  partitions are not  recognized,
  4577. then you will not be able to access them in any way.
  4578.   There are several things that can cause this to happen:
  4579.  
  4580.  o  Hard drive or controller not supported.   If you are using  a hard
  4581.     drive controller (IDE, SCSI,  or otherwise) that is not  supported
  4582.     by Linux, the  kernel will not recognize  your partitions at  boot
  4583.     time.
  4584.  
  4585.  o  Drive  or  controller  improperly  configured.     Even   if  your
  4586.     controller is  supported  by  Linux,  it  may  not  be  configured
  4587.     correctly.  (This is particularly a problem for  SCSI controllers;
  4588.     most non-SCSI controllers should work fine without  any additional
  4589.     configuration).
  4590.  
  4591.     Refer to the documentation  for your hard drive and/or  controller
  4592.     for  information  on  solving  these  kinds  of  problems.      In
  4593.     particular, many hard  drives will need  to have  a jumper set  if
  4594.     they are to  be used  as a  ``slave'' drive (for  example, as  the
  4595.     second hard drive).  The  acid test for this kind of  condition is
  4596.     to boot up MS-DOS, or  some other operating system, known  to work
  4597.     with your drive and controller.   If you can access the  drive and
  4598.     controller from another operating system, then it is not a problem
  4599.     with your hardware configuration.
  4600.  
  4601.     See Section 2.5.2.1, above, for information on  resolving possible
  4602.     device conflicts, and Section  2.5.2.3, below, for information  on
  4603.     configuring SCSI devices.
  4604.  
  4605.  o  Controller properly configured, but not detected.   Some BIOS-less
  4606.     SCSI controllers require the user to specify information about the
  4607.     controller at boot time.  Section 2.5.2.3, below, describes how to
  4608.     force hardware detection for these controllers.
  4609.  
  4610.  o  Hard drive geometry not recognized.  Some systems, such as the IBM
  4611.     PS/ValuePoint, do not store hard drive geometry information in the
  4612.     CMOS memory, where Linux expects to  find it.  Also,  certain SCSI
  4613.     controllers need to be told where to find drive  geometry in order
  4614.     for Linux to recognize the layout of your drive.
  4615.  
  4616.     Most distributions provide  a bootup option  to specify the  drive
  4617.     geometry.  In  general, when booting  the installation media,  you
  4618. 2.5.   Running Into Trouble                                         78
  4619. _______________________________________________________________________
  4620.  
  4621.     can specify the  drive geometry  at the  LILO boot  prompt with  a
  4622.     command such as:
  4623.  
  4624.  
  4625.         boot:  linux hd=<cylinders>,<heads>,<sectors>
  4626.  
  4627.  
  4628.     where <cylinders>, <heads>,  and <sectors> correspond to  the number
  4629.     of cylinders, heads, and sectors per track for your hard drive.
  4630.  
  4631.     After installing the Linux software,  you will be able  to install
  4632.     LILO, allowing you to boot from the hard drive.  At that time, you
  4633.     can specify the drive geometry to the LILO installation procedure,
  4634.     making it unnecessary  to enter the drive  geometry each time  you
  4635.     boot.  See Chapter 4 for more about LILO.
  4636.  
  4637.  
  4638. 2.5.2.3 Problems with SCSI controllers and devices
  4639.  
  4640. Presented here  are  some  of  the  most  common  problems  with  SCSI
  4641. controllers and devices such as CD-ROMs, hard drives, and tape drives.
  4642. If you are having  problems getting Linux  to recognize your drive  or
  4643. controller, read on.
  4644.   The  Linux  SCSI  HOWTO  (see  Appendix  A)   contains  much  useful
  4645. information on SCSI devices in addition to that listed here.  SCSI can
  4646. be particularly tricky to configure at times.
  4647.  
  4648.  o  A SCSI device is  detected at all possible  ID's.  This is  caused
  4649.     by strapping the  device to  the same address  as the  controller.
  4650.     You need to change  the jumper settings so  that the drive uses  a
  4651.     different address from the controller itself.
  4652.  
  4653.  o  Linux reports  sense errors,  even  if the  devices  are known  to
  4654.     be error-free.    This can  be caused  by bad  cables,  or by  bad
  4655.     termination.  If your SCSI bus is not terminated at both ends, you
  4656.     may have errors  accessing SCSI devices.    When in doubt,  always
  4657.     check your cables.
  4658.  
  4659.  o  SCSI devices report timeout errors.   This is usually caused  by a
  4660.     conflict with IRQ,  DMA, or  device addresses.    Also check  that
  4661.     interrupts are enabled correctly on your controller.
  4662.  
  4663.  o  SCSI controllers  using  BIOS are  not  detected.    Detection  of
  4664.     controllers using BIOS will  fail if the  BIOS is disabled, or  if
  4665.     your controller's ``signature'' is  not recognized by the  kernel.
  4666.     See the Linux SCSI HOWTO for more information about this.
  4667.  
  4668.  o  Controllers using  memory  mapped  I/O  do  not work.     This  is
  4669.     caused when the  memory-mapped I/O  ports are incorrectly  cached.
  4670.     Either mark the board's address space as uncacheable in  the XCMOS
  4671. 2.5.   Running Into Trouble                                         79
  4672. _______________________________________________________________________
  4673.  
  4674.     settings, or disable cache altogether.
  4675.  
  4676.  o  When partitioning, you get a warning that ``cylinders > 1024'', or
  4677.     you are unable to boot  from a partition using  cylinders numbered
  4678.     above 1023.  BIOS limits the number of cylinders to  1024, and any
  4679.     partition using cylinders numbered above this won't  be accessible
  4680.     from the BIOS.  As far as  Linux is  concerned, this affects  only
  4681.     booting; once the system has  booted you should be able  to access
  4682.     the partition.    Your options  are to  either boot  Linux from  a
  4683.     boot floppy,  or boot from  a partition  using cylinders  numbered
  4684.     below 1024.  See Section 2.3.7 for information on  creating a boot
  4685.     diskette or installing LILO.
  4686.  
  4687.  o  CD-ROM drive or other removeable media devices are  not recognized
  4688.     at boot time.  Try booting  with a CD-ROM (or disk) in  the drive.
  4689.     This is necessary for some devices.
  4690.  
  4691.   If your  SCSI controller is  not recognized, you  may need to  force
  4692. hardware detection  at boot  time.    This is  particularly  important
  4693. for BIOS-less  SCSI controllers.    Most  distributions allow  you  to
  4694. specify the  controller IRQ  and shared  memory  address when  booting
  4695. the installation  media.   For  example, if  you are  using a  TMC-8xx
  4696. controller, you may be able to enter
  4697.  
  4698.     boot:  linux tmx8xx=<interrupt>,<memory-address>
  4699.  
  4700. at the LILO boot  prompt, where <interrupt> is  the IRQ of controller,
  4701. and <memory-address> is the shared memory address.  Whether or not you
  4702. will be able to do this  depends on the distribution of Linux  you are
  4703. using; consult your documentation for details.
  4704.  
  4705. 2.5.3 Problems installing the software
  4706.  
  4707. Actually installing the Linux  software should be quite  trouble-free,
  4708. if you're lucky.  The only problems that you might experience would be
  4709. related to corrupt installation media  or lack of space on  your Linux
  4710. filesystems.  Here is a list of these common problems.
  4711.  
  4712.  
  4713.  o  System reports ``Read error'', ``file not found'', or other errors
  4714.     while attempting to install the software.  This is indicative of a
  4715.     problem with your installation media.  If you  are installing from
  4716.     floppy, keep in mind that floppies are quite succeptible  to media
  4717.     errors of this type.   Be  sure to use brand-new,  newly-formatted
  4718.     floppies.   If you have  an MS-DOS partition  on your drive,  many
  4719.     Linux distributions allow  you to  install the  software from  the
  4720.     hard drive.    This may  be faster  and more  reliable than  using
  4721.     floppies.
  4722.  
  4723.     If you  are  using  a  CD-ROM,  be sure  to  check  the  disc  for
  4724.     scratches, dust, or other problems which might cause media errors.
  4725. 2.5.   Running Into Trouble                                         80
  4726. _______________________________________________________________________
  4727.  
  4728.     The cause of the problem may be that the media is in the incorrect
  4729.     format.  For example, if using floppies, many  Linux distributions
  4730.     require that  the floppies  be  formatted in  high-density  MS-DOS
  4731.     format.  (The boot  floppy is the exception;  it is not in  MS-DOS
  4732.     format in most cases.)  If all else fails, either obtain a new set
  4733.     of floppies, or recreate the floppies (using new diskettes) if you
  4734.     downloaded the software yourself.
  4735.  
  4736.  o  System reports errors such as ``tar:  read error'' or ``gzip:  not
  4737.     in gzip  format''.   This  problem is  usually  caused by  corrupt
  4738.     files on the  installation media  itself.   In  other words,  your
  4739.     floppy may be error-free,  but the data on  the floppy is in  some
  4740.     way corrupted.  For example, if you downloaded  the Linux software
  4741.     using text mode, rather than binary mode, then your  files will be
  4742.     corrupt, and unreadable by the installation software.
  4743.  
  4744.  o  System reports errors  such as  ``device full'' while  installing.
  4745.     This is  a clear-cut  sign that  you have  run out  of space  when
  4746.     installing the software.  Not all Linux distributions will be able
  4747.     to cleanly pick up  the mess; you shouldn't  be able to abort  the
  4748.     installation and expect the system to work.
  4749.  
  4750.     The solution  is  usually  to  re-create  your  filesystems  (with
  4751.     the mke2fs  command)  which  will delete  the  partially-installed
  4752.     software.  You can  then attempt to re-install the software,  this
  4753.     time selecting a smaller amount of software to install.   In other
  4754.     cases, you may need to start completely from scratch,  and rethink
  4755.     your partition and filesystem sizes.
  4756.  
  4757.  o  System reports errors such as ``read_intr:   0x10'' while accessing
  4758.     the hard drive.   This is usually  an indication of bad blocks  on
  4759.     your drive.   However,  if you  receive these  errors while  using
  4760.     mkswap or mke2fs, the system may be having trouble  accessing your
  4761.     drive.  This can either be a hardware problem (see Section 2.5.2),
  4762.     or it might be a case of  poorly specified geometry.  If  you used
  4763.     the
  4764.  
  4765.  
  4766.         hd=<cylinders>,<heads>,<sectors>
  4767.  
  4768.  
  4769.     option at boot  time to  force detection of  your drive  geometry,
  4770.     and incorrectly  specified the  geometry, you  could  be prone  to
  4771.     this problem.   This  can also  happen if your  drive geometry  is
  4772.     incorrectly specified in the system CMOS.
  4773.  
  4774.  o  System reports errors such  as ``file not found'' or  ``permission
  4775.     denied''.   This problem  can occur  if not all  of the  necessary
  4776.     files  are  present  on  the  installation  media  (see  the  next
  4777.     paragraph)  or  if  there  is  a  permissions  problem   with  the
  4778. 2.5.   Running Into Trouble                                         81
  4779. _______________________________________________________________________
  4780.  
  4781.     installation software.  For  example, some distributions of  Linux
  4782.     have been known to have bugs in the installation  software itself.
  4783.     These are usually  fixed very rapidly,  and are quite  infrequent.
  4784.     If you suspect that the  distribution software contains bugs,  and
  4785.     you're sure that  you have  not done anything  wrong, contact  the
  4786.     maintainer of the distribution to report the bug.
  4787.  
  4788.   If you have  other strange errors when installing  Linux (especially
  4789. if you downloaded the  software yourself), be  sure that you  actually
  4790. obtained all of the  necessary files when  downloading.  For  example,
  4791. some people use the FTP command
  4792.  
  4793.     mget *.*
  4794.  
  4795. when downloading the Linux software  via FTP. This will download  only
  4796. those files that contain a ``.''  in their filenames; if there are any
  4797. files without the ``.'', you will  miss them.  The correct  command to
  4798. use in this case is
  4799.  
  4800.     mget *
  4801.  
  4802.   The best advice is to retrace your steps  when something goes wrong.
  4803. You may think that  you have done  everything correctly, when in  fact
  4804. you forgot a small  but important step  somewhere along the  way.   In
  4805. many cases,  just attempting to  re-download or  re-install the  Linux
  4806. software can solve the problem.  Don't beat your head against the wall
  4807. any longer than you have to!
  4808.   Also, if Linux unexpectedly hangs during installation,  there may be
  4809. a hardware problem of some kind.  See Section 2.5.2 for hints.
  4810.  
  4811. 2.5.4 Problems after installing Linux
  4812.  
  4813. You've spent an entire afternoon installing  Linux.  In order  to make
  4814. space for it, you wiped your MS-DOS and OS/2 partitions, and tearfully
  4815. deleted your copies  of SimCity and  Wing Commander.   You reboot  the
  4816. system, and nothing happens.   Or, even worse, something happens,  but
  4817. it's not what should happen.  What do you do?
  4818.   In Section 2.5.1, we  covered some of the most common  problems that
  4819. can occur when  booting the Linux  installation media---many of  those
  4820. problems may apply here.  In addition, you may be victim to one of the
  4821. following maladies.
  4822.  
  4823. 2.5.4.1 Problems booting Linux from floppy
  4824.  
  4825. If you are  using a  floppy to  boot Linux,  you may  need to  specify
  4826. the location of  your Linux  root partition  at boot  time.   This  is
  4827. especially true  if you  are using  the  original installation  floppy
  4828. itself, and not a custom boot floppy created during installation.
  4829.   While booting the floppy, hold down [shift] or [ctrl].   This should
  4830. present you with a boot menu;  press [tab] to see a list  of available
  4831. 2.5.   Running Into Trouble                                         82
  4832. _______________________________________________________________________
  4833.  
  4834. options.  For example, many distributions allow you to type
  4835.  
  4836.     boot:  linux hd=<partition>
  4837.  
  4838. at the boot  menu,  where <partition>  is the  name of the  Linux root
  4839. partition, such  as /dev/hda2.    Consult the  documentation for  your
  4840. distribution for details.
  4841.  
  4842. 2.5.4.2 Problems booting Linux from the hard drive
  4843.  
  4844. If you opted to install LILO, instead of creating a boot  floppy, then
  4845. you should be able to  boot Linux from the  hard drive.  However,  the
  4846. automated LILO installation  procedure used  by many distributions  is
  4847. not always perfect.    It may  make incorrect  assumptions about  your
  4848. partition layout, in which  case you will  need to re-install LILO  to
  4849. get everything right.  Installing LILO is covered in Chapter 4.
  4850.  
  4851.  o  System reports ``Drive not bootable---Please insert system disk.''
  4852.     You will get this  error message if  the hard drive's master  boot
  4853.     record is corrupt in some way.  In most cases,  it's harmless, and
  4854.     everything else on your drive is still intact.   There are several
  4855.     ways around this:
  4856.  
  4857.  
  4858.     1.  While partitioning  your  drive  using  fdisk,  you  may  have
  4859.         deleted the partition that was  marked as ``active''.   MS-DOS
  4860.         and other  operating systems  attempt to  boot the  ``active''
  4861.         partition at boot time (Linux pays no attention to whether the
  4862.         partition is ``active''  or not).    You may be  able to  boot
  4863.         MS-DOS from floppy  and run FDISK  to set  the active flag  on
  4864.         your MS-DOS paritition, and all will be well.
  4865.  
  4866.         Another command to try (with MS-DOS 5.0 and higher) is
  4867.  
  4868.  
  4869.             FDISK /MBR
  4870.  
  4871.  
  4872.         This command  will attempt to  rebuild the  hard drive  master
  4873.         boot record for  booting MS-DOS, overwriting  LILO. If you  no
  4874.         longer have MS-DOS  on your  hard drive,  you'll need to  boot
  4875.         Linux from floppy and attempt to install LILO later.
  4876.  
  4877.     2.  If you created  an MS-DOS partition  using Linux's version  of
  4878.         fdisk, or  vice versa, you  may get  this error.   You  should
  4879.         create MS-DOS partitions  only using  MS-DOS's version  FDISK.
  4880.         (The same  applies to  operating systems  other than  MS-DOS.)
  4881.         The best solution  here is  either to start  from scratch  and
  4882.         repartition the  drive  correctly,  or to  merely  delete  and
  4883.         re-create the offending  partitions using the correct  version
  4884. 2.5.   Running Into Trouble                                         83
  4885. _______________________________________________________________________
  4886.  
  4887.         of fdisk.
  4888.  
  4889.     3.  The LILO  installation procedure  may have  failed.   In  this
  4890.         case, you  should  either boot  from  your Linux  boot  floppy
  4891.         (if you have  one), or from  the original installation  media.
  4892.         Either of  these  should provide  options for  specifying  the
  4893.         Linux root partition to use  when booting.  Hold  down [shift]
  4894.         or [ctrl] at boot time, and press [tab] from the boot menu for
  4895.         a list of options.
  4896.  
  4897.  
  4898.  o  When booting the system  from the hard  drive, MS-DOS (or  another
  4899.     operating system)  starts instead  of Linux.    First of  all,  be
  4900.     sure that you  actually installed LILO  when installing the  Linux
  4901.     software.   If not,  then the  system will still  boot MS-DOS  (or
  4902.     whatever other operating system you may have) when you  attempt to
  4903.     boot from the hard drive.   In order  to boot Linux from the  hard
  4904.     drive, you will need to install LILO (see Chapter 4).
  4905.  
  4906.     On the other hand, if you did install LILO,  and another operating
  4907.     system boots instead of  Linux, then you  have LILO configured  to
  4908.     boot that other  operating system by  default.   While the  system
  4909.     is booting, hold down  [shift] or [ctrl],  and press [tab] at  the
  4910.     boot prompt.   This  should present  you with a  list of  possible
  4911.     operating systems to boot; select the appropriate  option (usually
  4912.     just ``linux'') to boot Linux.
  4913.  
  4914.     If you wish  to select Linux  as the  default operating system  to
  4915.     boot, you will need to re-install LILO. See Chapter 4.
  4916.  
  4917.     It also may be  possible that you  attempted to install LILO,  but
  4918.     the installation procedure failed in  some way.  See  the previous
  4919.     item.
  4920.  
  4921. 2.5.4.3 Problems logging in
  4922.  
  4923. After booting Linux, you should be presented with a login prompt, like
  4924. so:
  4925.  
  4926.     linux login:
  4927.  
  4928. At this point, either  the distribution's documentation or the  system
  4929. itself will tell you what to  do.  For many distributions,  you simply
  4930. login as root, with no password.  Other possible usernames  to try are
  4931. guest or test.
  4932.   Most newly-installed  Linux systems  should not  require a  password
  4933. for the initial login.  However, if you are asked to enter a password,
  4934. there may be a problem.  First, try using a password equivalent to the
  4935. username; that is, if you are logging in as root, use  ``root'' as the
  4936. password.
  4937. 2.5.   Running Into Trouble                                         84
  4938. _______________________________________________________________________
  4939.  
  4940.   If you simply can't login,  there may be a problem.   First, consult
  4941. your distribution's documentation;  the username  and password to  use
  4942. may be buried in there somewhere.  The username and  password may have
  4943. been given to you  during the installation  procedure, or they may  be
  4944. printed on the login banner.
  4945.   One  cause of  this  may be  a  problem  with installing  the  Linux
  4946. login and  initialization  files.    If  this  is the  case,  you  may
  4947. need to reinstall  (at least  parts of)  the Linux  software, or  boot
  4948. your installation media and attempt  to fix the problem by  hand---see
  4949. Chapter 4 for hints.
  4950.  
  4951. 2.5.4.4 Problems using the system
  4952.  
  4953. If login is successful,  you should be  presented with a shell  prompt
  4954. (such as ``#''  or ``$'')  and can  happily roam  around your  system.
  4955. However, there are  some initial problems with  using the system  that
  4956. sometimes creep up.
  4957.   The most common  initial configuration problem is incorrect  file or
  4958. directory permissions.  This can cause the error message
  4959.  
  4960.     Shell-init:  permission denied
  4961.  
  4962. to be printed after logging in (in fact, any time you  see the message
  4963. ``permission denied'' you can be  fairly certain that it is  a problem
  4964. with file permissions).
  4965.   In many cases,  it's a simple matter  of using the chmod command  to
  4966. fix the permissions  of the  appropriate files  or directories.    For
  4967. example, some distributions  of Linux once  used the (incorrect)  file
  4968. mode 0644  for the  root directory  (/).   The  fix was  to issue  the
  4969. command
  4970.  
  4971.     # chmod 755 /
  4972.  
  4973. as root.  However, in order to issue this command, you  needed to boot
  4974. from the installation media  and mount your  Linux root filesystem  by
  4975. hand---a hairy task for most newcomers.
  4976.   As you  use  the system,  you may  run  into places  where file  and
  4977. directory permissions  are incorrect,  or software  does  not work  as
  4978. configured.  Welcome to the world of Linux!   While most distributions
  4979. are quite trouble-free, very few of  them are perfect.  We  don't want
  4980. to cover all of those problems here.  Instead, throughout  the book we
  4981. help you to solve many of these configuration problems by teaching you
  4982. how to find them  and fix them  yourself.   In Chapter 1 we  discussed
  4983. this philosophy in  some detail.    In Chapter  4, we  give hints  for
  4984. fixing many of these common configuration problems.
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993. Chapter 3
  4994.  
  4995.  
  4996.  
  4997.  
  4998. Linux Tutorial
  4999.  
  5000.  
  5001.  
  5002. 3.1 Introduction
  5003.  
  5004. New users of UNIX and Linux may  be a bit intimidated by the  size and
  5005. apparent complexity of the  system before them.   There are many  good
  5006. books on using UNIX out there, for all levels of expertise from novice
  5007. to expert.   However,  none of  these books  covers, specifically,  an
  5008. introduction to using Linux.  While 95% of using Linux is exactly like
  5009. using other UNIX systems, the most straightforward way to get going on
  5010. your new system is with a tutorial tailored for Linux.  Herein is such
  5011. a tutorial.
  5012.   This chapter  does not  go into a  large amount  of detail or  cover
  5013. many advanced topics.   Instead, it is  intended to get the new  Linux
  5014. user running, on both  feet, so that  he or she  may then read a  more
  5015. general book about UNIX and  understand the basic differences  between
  5016. other UNIX systems and Linux.
  5017.   Very little  is assumed here,  except perhaps some familiarity  with
  5018. personal computer systems, and MS-DOS. However, even if you're  not an
  5019. MS-DOS user, you  should be able  to understand everything  here.   At
  5020. first glance, UNIX looks a lot like MS-DOS (after all, parts of MS-DOS
  5021. were modeled on the CP/M operating  system, which in turn  was modeled
  5022. on UNIX). However, only the very superficial features of UNIX resemble
  5023. MS-DOS in any way.   Even  if you're completely  new to the PC  world,
  5024. this tutorial should be of help.
  5025.   And, before we  begin:  Don't be afraid  to experiment.   The system
  5026. won't bite you.  You can't destroy anything by working  on the system.
  5027. UNIX has some amount of security built in, to prevent ``normal'' users
  5028. (the role which  you will now  assume) from  damaging files which  are
  5029. essential to the system.   Even so, the absolute worst thing  that can
  5030. happen is that you'll delete all of your files---and you'll have to go
  5031. back and re-install the system.   So, at this point, you  have nothing
  5032. to lose.
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.                                   85
  5040. 3.2.   Basic UNIX Concepts                                          86
  5041. _______________________________________________________________________
  5042.  
  5043. 3.2 Basic UNIX Concepts
  5044.  
  5045. UNIX is a multitasking, multiuser  operating system.  This  means that
  5046. there can be many people using one computer at the same  time, running
  5047. many different applications.   (This differs  from MS-DOS, where  only
  5048. one person can use the system at any one time.)  Under UNIX, for users
  5049. to identify themselves to the system, they must log in,  which entails
  5050. two steps:   Entering  your  login name  (the  name which  the  system
  5051. identifies you as), and entering your password, which is your personal
  5052. secret key to logging into your  account.  Because only you  know your
  5053. password, no one else can login to the system under your username.
  5054.   On traditional  UNIX systems, the  system administrator will  assign
  5055. you a username and an initial  password when you are given  an account
  5056. on the system.  However, because you are the system administrator, you
  5057. must set up your own account before you can login---see Section 3.2.1,
  5058. below.    For  the  following discussions,  we'll  use  the  imaginary
  5059. username ``larry''.
  5060.   In addition,  each UNIX system has  a hostname assigned  to it.   It
  5061. is this hostname that  gives your machine  a name, gives it  character
  5062. and charm.    The hostname  is used  to  identify individual  machines
  5063. on a network,  but even  if your  machine isn't  networked, it  should
  5064. have a  hostname.     In  Section  4.10.2  we'll  cover  setting  your
  5065. system's hostname.  For our examples, below, the  system's hostname is
  5066. ``mousehouse''.
  5067.  
  5068. 3.2.1 Creating an account
  5069.  
  5070. Before you can  use the system,  you must  set up  a user account  for
  5071. yourself.  This  is because it's  usually not a  good idea to use  the
  5072. root account for  normal use.    The root account  should be  reserved
  5073. for running privileged  commands and  for maintaining  the system,  as
  5074. discussed in Section 4.1.
  5075.   In order  to create an account  for yourself, you  need to login  as
  5076. root and use  the useradd  or adduser command.    See Section 4.4  for
  5077. information on this procedure.
  5078.  
  5079. 3.2.2 Logging in
  5080.  
  5081. At login time, you'll  see a prompt  resembling the following on  your
  5082. screen:
  5083.  
  5084.  
  5085.     mousehouse login:
  5086.  
  5087.   Here, enter your  username, and press the  [Return] key.  Our  hero,
  5088. larry, would type the following:
  5089.  
  5090.     mousehouse login:  larry
  5091.     Password:
  5092. 3.2.   Basic UNIX Concepts                                          87
  5093. _______________________________________________________________________
  5094.  
  5095.   Now, enter  your password.   It won't be  echoed to the screen  when
  5096. you login, so type  carefully.  If  you mistype your password,  you'll
  5097. see the message
  5098.  
  5099.     Login incorrect
  5100.  
  5101. and you'll have to try again.
  5102.   Once you have correctly  entered the username and password,  you are
  5103. officially logged into the system, and are free to roam.
  5104.  
  5105. 3.2.3 Virtual consoles
  5106.  
  5107. The system's console is the monitor and keyboard connected directly to
  5108. the system.   (Because UNIX is a  multiuser operating system, you  may
  5109. have other terminals  connected to  serial ports on  your system,  but
  5110. these would not be the console.)   Linux, like some other  versions of
  5111. UNIX, provides access to virtual  consoles (or VC's), which  allow you
  5112. to have more than one login session from your console at a time.
  5113.   To demonstrate this,  login to your system (as  demonstrated above).
  5114. Now, press [alt-F2].  You should see the login:  prompt again.  You're
  5115. looking at the second virtual console---you logged into the first.  To
  5116. switch back to the first VC, press  [alt-F1].  Voila!  You're  back to
  5117. your first login session.
  5118.   A newly-installed  Linux system  probably allows you  to access  the
  5119. first four VC's,  using [alt-F1]  through [alt-F4].    However, it  is
  5120. possible to enable up to 12  VC's---one for each function key  on your
  5121. keyboard.  As you can see, use of VC's can be  very powerful---you can
  5122. be working on several different VC's at once.
  5123.   While the use of VC's is somewhat limiting (after  all, you can only
  5124. be looking at one VC at a time), it should give you a  feel for UNIX's
  5125. multiuser capabilities.  While you're working on VC #1, you can switch
  5126. over to VC #2 and start working on something else.
  5127.  
  5128. 3.2.4 Shells and commands
  5129.  
  5130. For most of your explorations in the world of UNIX,  you'll be talking
  5131. to the  system  through the  use  of a  shell.    A  shell is  just  a
  5132. program which takes  user input  (e.g., commands which  you type)  and
  5133. translates them  into instructions.    This  can  be compared  to  the
  5134. COMMAND.COM program  under MS-DOS,  which  does essentially  the  same
  5135. thing.   The  shell is  just one  interface to  UNIX.  There are  many
  5136. possible interfaces---such as the X Window System, which lets  you run
  5137. commands by using the mouse and keyboard in conjunction.
  5138.   As soon as you login, the system starts the shell,  and you can type
  5139. commands to it.  Here's a quick example.  Here, Larry logs  in, and is
  5140. left sitting at the shell prompt.
  5141.  
  5142.     mousehouse login:  larry
  5143.     Password:  larry's password
  5144.     Welcome to Mousehouse!
  5145. 3.2.   Basic UNIX Concepts                                          88
  5146. _______________________________________________________________________
  5147.  
  5148.  
  5149.     /home/larry#
  5150.  
  5151. ``/home/larry#'' is the shell's prompt, indicating that it's  ready to
  5152. take commands.  (More on what  the prompt itself means later.)   Let's
  5153. try telling the system to do something interesting:
  5154.  
  5155.     /home/larry# make love
  5156.     make:  *** No way to make target `love'.  Stop.
  5157.     /home/larry#
  5158.  
  5159.   Well, as it turns out make was the name of an  actual program on the
  5160. system, and the  shell executed this program  when given the  command.
  5161. (Unfortunately, the system was being unfriendly.)
  5162.   This brings us  to one burning question:   What are commands?   What
  5163. happens when you type ``make  love''?  The  first word on the  command
  5164. line, ``make'', is the name of the command to be executed.  Everything
  5165. else on  the command  line  is taken  as  arguments to  this  command.
  5166. Examples:
  5167.  
  5168.     /home/larry# cp foo bar
  5169.  
  5170. Here, the name of the command is ``cp'', and the arguments are ``foo''
  5171. and ``bar''.
  5172.   When you type  a command, the shell does  several things.   First of
  5173. all, it  looks at  the command  name, and  checks to  see if  it is  a
  5174. command which is internal  to the shell.   (That  is, a command  which
  5175. the shell knows how to  execute itself.   There are a number of  these
  5176. commands, and we'll go into them later.)  The shell also checks to see
  5177. if the command is an alias,  or substitute name, for  another command.
  5178. If neither of these conditions apply,  the shell looks for  a program,
  5179. on the disk, with  the command's name.   If  it finds such a  program,
  5180. the shell runs it, giving  the program the arguments specified  on the
  5181. command line.
  5182.   In our  example, the shell  looks for the  program called make,  and
  5183. runs it with  the argument  love.   Make is  a program  often used  to
  5184. compile large  programs,  and it  takes  as arguments  the name  of  a
  5185. ``target'' to compile.   In the case  of ``make love'', we  instructed
  5186. make to compile the target love.  Because make can't find  a target by
  5187. this name, it fails with a humorous error message, and we are returned
  5188. to the shell prompt.
  5189.   What happens if  we type a command to  a shell, and the  shell can't
  5190. find a program with the command name to run?  Well, we can try it:
  5191.  
  5192.     /home/larry# eat dirt
  5193.     eat:  command not found
  5194.     /home/larry#
  5195.  
  5196. Quite simply, if the  shell can't find a  program with the name  given
  5197. on the command line (here, ``eat''), it prints an  error message which
  5198. 3.2.   Basic UNIX Concepts                                          89
  5199. _______________________________________________________________________
  5200.  
  5201. should be self-explanatory.   You'll often  see this error message  if
  5202. you mistype a  command (for example,  if you  had typed ``mkae  love''
  5203. instead of ``make love'').
  5204.  
  5205. 3.2.5 Logging out
  5206.  
  5207. Before we delve much further, we should tell you how to log out of the
  5208. system.  At the shell prompt, use the command
  5209.  
  5210.     /home/larry# exit
  5211.  
  5212. to logout.  There are other  ways of logging out as well, but  this is
  5213. the most foolproof one.
  5214.  
  5215. 3.2.6 Changing your password
  5216.  
  5217. You should also be aware of how to change your password.   The command
  5218. passwd will prompt you for your  old password, and your  new password.
  5219. It will  ask you  to reenter  the new  password for  validation.    Be
  5220. careful not to forget your password---if you do, you will  have to ask
  5221. the system administrator to reset it  for you.  (If you're  the system
  5222. administrator, see Section 4.4.)
  5223.  
  5224.  
  5225. 3.2.7 Files and directories
  5226.  
  5227. Under most operating systems (UNIX included), there is the  concept of
  5228. a file, which is  just a bundle of  information which is given a  name
  5229. (called a filename).   Examples  of files would  be your history  term
  5230. paper, an e-mail message, or an actual program which  can be executed.
  5231. Essentially, anything which is saved on disk is saved in an individual
  5232. file.
  5233.   Files are  identified by  their filenames.   For  example, the  file
  5234. containing your  history  paper  might  be  saved  with  the  filename
  5235. history-paper.  These names usually identify the file and its contents
  5236. in some form which is meaningful to you.  There is  no standard format
  5237. for filenames as there  is under MS-DOS  and other operating  systems;
  5238. in general, filenames  may contain any  character (except /---see  the
  5239. discussion of pathnames, below), and are limited to 256  characters in
  5240. length.
  5241.   With the  concept of  files comes  the concept  of directories.    A
  5242. directory is  just a  collection  of files.    It  can be  thought  of
  5243. as a  ``folder'' which  contains many  different files.    Directories
  5244. themselves are  given  names,   with  which  you  can  identify  them.
  5245. Furthermore, directories are maintained in a tree-like structure; that
  5246. is, directories may contain other directories.
  5247.   A file  may be  referred to  by its pathname,  which is  made up  of
  5248. the filename, preceded  by the  name of the  directory which  contains
  5249. the file.  For  example, let's say  that Larry has a directory  called
  5250. papers, which contains three  files:  history-final, english-lit,  and
  5251. masters-thesis.  (Each of  these three files contains information  for
  5252. 3.2.   Basic UNIX Concepts                                          90
  5253. _______________________________________________________________________
  5254.  
  5255. three of Larry's ongoing projects.)  To refer to the file english-lit,
  5256. Larry can specify the file's pathname:
  5257.  
  5258.     papers/english-lit
  5259.  
  5260.   As  you can  see, the  directory  and file  names  are separated  by
  5261. a single slash  (/).   For  this reason,  filenames themselves  cannot
  5262. contain the  / character.    MS-DOS users  will  find this  convention
  5263. familiar, although  in the  MS-DOS world,  the backslash  (\) is  used
  5264. instead.
  5265.   As mentioned, directories can  be nested within each other  as well.
  5266. For example,  let's  say  that Larry  has  another  directory,  within
  5267. papers, called notes.   This directory  contains the files  math-notes
  5268. and cheat-sheet.  The pathname of the file cheat-sheet would be
  5269.  
  5270.     papers/notes/cheat-sheet
  5271.  
  5272.   Therefore,  the pathname  really is  a ``path''  which  you take  to
  5273. locate a certain file.   The directory  above a given subdirectory  is
  5274. known as the  parent directory.   Here,  the directory  papers is  the
  5275. parent of the notes directory.
  5276.  
  5277. 3.2.8 The directory tree
  5278.  
  5279. Most UNIX systems  have a standard  layout for  files, so that  system
  5280. resources and  programs can  be easily  located.    This layout  forms
  5281. a directory tree,  which  starts at  the ``/''  directory, also  known
  5282. as ``the root directory''.   Directly underneath / are  some important
  5283. subdirectories:  /bin,  /etc, /dev,  and /usr,  among others.    These
  5284. directories in  turn contain  other directories  which contain  system
  5285. configuration files, programs, and so on.
  5286.   In  particular,  each  user has  a  home  directory,  which  is  the
  5287. directory set aside  for that  user to  store his or  her files.    In
  5288. the examples  above, all  of Larry's  files (such  as cheat-sheet  and
  5289. history-final) were contained  in Larry's  home directory.    Usually,
  5290. user home directories are contained under /home, and are named for the
  5291. user who owns that  directory.   Therefore, Larry's home directory  is
  5292. /home/larry.
  5293.   In Figure 3.2.8 a  sample directory tree is represented.   It should
  5294. give you  some  idea of  how  the directory  tree  on your  system  is
  5295. organized.
  5296.  
  5297. 3.2.9 The current working directory
  5298.  
  5299. At any  given time,  commands that  you type  to the  shell are  given
  5300. in terms  of  your  current working  directory.    You  can  think  of
  5301. your working directory  as the  directory in which  you are  currently
  5302. ``located''.  When you first  login, your working directory is  set to
  5303. your home directory---/home/larry in our case.  Whenever you reference
  5304. a file, you may  refer to it in  relationship to your current  working
  5305. 3.2.   Basic UNIX Concepts                                          91
  5306. _______________________________________________________________________
  5307.  
  5308.  
  5309.  
  5310. /___|_bin
  5311.     |_dev
  5312.     |_etc
  5313.     |_home_____larry
  5314.     |        |_sam
  5315.     |_lib
  5316.     |_proc
  5317.     |_tmp
  5318.     |_usr__|X386
  5319.            |_bin
  5320.            |_emacs
  5321.            |_etc
  5322.            |_g++-include
  5323.            |_include
  5324.            |_lib
  5325.            |_local_____bin
  5326.            |         |_emacs
  5327.            |         |_etc
  5328.            |         |_lib
  5329.            |_man
  5330.            |_spool
  5331.            |_src_____linux
  5332.            |_tmp
  5333.  
  5334.  
  5335.  
  5336.         Figure 3.1:  A typical (abridged) Unix directory tree.
  5337.  
  5338.  
  5339.  
  5340. directory, instead of specifying the full pathname of the file.
  5341.   Here's an  example.    Larry has  the directory  papers, and  papers
  5342. contains the file history-final.  If Larry wants to look at this file,
  5343. he can use the command
  5344.  
  5345.     /home/larry# more /home/larry/papers/history-final
  5346.  
  5347. The more  command  simply displays  a  file,  one  screen at  a  time.
  5348. However, because Larry's current working directory is  /home/larry, he
  5349. can instead refer to the file  relative to his current location.   The
  5350. command would be
  5351.  
  5352.     /home/larry# more papers/history-final
  5353.  
  5354. Therefore, if  you begin  a  filename (such  as  papers/final) with  a
  5355. character other than ``/'',  the system assumes that you're  referring
  5356. 3.3.   First Steps into UNIX                                        92
  5357. _______________________________________________________________________
  5358.  
  5359. to the file in terms relative to your current working directory.  This
  5360. is known as a relative pathname.
  5361.   On the other hand, if you begin a filename with  a ``/'', the system
  5362. interprets this as a full pathname---that is, a pathname including the
  5363. entire path to the file, starting from the root directory, /.  This is
  5364. known as an absolute pathname.
  5365.  
  5366. 3.2.10 Referring to home directories
  5367.  
  5368. Under both tcsh and  bash,(1) your home  directory can be referred  to
  5369. using the tilde character (``~'').  For example, the command
  5370.  
  5371.     /home/larry# more ~/papers/history-final
  5372.  
  5373. is equivalent to
  5374.  
  5375.     /home/larry# more /home/larry/papers/history-final
  5376.  
  5377. The ``~'' character  is simply  replaced with  the name  of your  home
  5378. directory by the shell.
  5379.   In addition,  you  can specify  other user's  home directories  with
  5380. the tilde  as well.    The  pathname ``~karl/letters''  translates  to
  5381. ``/home/karl/letters'' by  the shell  (if  /home/karl is  karl's  home
  5382. directory).   The use  of the  tilde is  simply a  shortcut; there  is
  5383. no directory named ``~''---it's just  syntactic sugar provided by  the
  5384. shell.
  5385.  
  5386.  
  5387. 3.3 First Steps into UNIX
  5388.  
  5389. Before we begin,  it is important  to note that  all file and  command
  5390. names on a  UNIX system are  case-sensitive (unlike operating  systems
  5391. such as MS-DOS). For example, the command make is  very different than
  5392. Make or MAKE. The same hold for file and directory names.
  5393.  
  5394. 3.3.1 Moving around
  5395.  
  5396. Now that we can login, and know how to refer to files using pathnames,
  5397. how can we change our current working directory, to make life easier?
  5398.   The command  for moving  around in  the directory  structure is  cd,
  5399. short for ``change directory''.   You'll  notice that many  often-used
  5400. Unix commands are two or three letters.   The usage of the  cd command
  5401. is:
  5402.  
  5403.     cd <directory>
  5404.  
  5405. ----------------------------
  5406.  1. tcsh and bash are  two shells running under  Linux.  The shell  is
  5407. the program which reads  user commands and  executes them; most  Linux
  5408. systems enable either tcsh or bash for new user accounts.
  5409. 3.3.   First Steps into UNIX                                        93
  5410. _______________________________________________________________________
  5411.  
  5412. where <directory>  is the  name  of the  directory  which you  wish to
  5413. change to.
  5414.   As we said,  when you login, you begin  in your home directory.   If
  5415. Larry wanted to move down into  the papers subdirectory, he'd  use the
  5416. command
  5417.  
  5418.     /home/larry# cd papers
  5419.     /home/larry/papers#
  5420.  
  5421. As you can see, Larry's prompt changes to reflect  his current working
  5422. directory (so he  knows where he  is).   Now that  he's in the  papers
  5423. directory, he can look at his history final with the command
  5424.  
  5425.     /home/larry/papers# more history-final
  5426.  
  5427.   Now, Larry is stuck in the papers subdirectory.  To  move back up to
  5428. the parent directory, use the command
  5429.  
  5430.     /home/larry/papers# cd ..
  5431.     /home/larry#
  5432.  
  5433. (Note the space between the ``cd''  and the ``..''.)   Every directory
  5434. has an  entry named  ``..''   which  refers to  the parent  directory.
  5435. Similarly, every directory has an entry  named ``.''  which  refers to
  5436. itself.  Therefore, the command
  5437.  
  5438.     /home/larry/papers# cd .
  5439.  
  5440. gets us nowhere.
  5441.   You can also use absolute  pathnames in the cd command.  To  cd into
  5442. Karl's home directory, we can use the command
  5443.  
  5444.     /home/larry/papers# cd /home/karl
  5445.     /home/karl#
  5446.  
  5447.   Also, using  cd with no  argument will return you  to your own  home
  5448. directory.
  5449.  
  5450.     /home/karl# cd
  5451.     /home/larry#
  5452.  
  5453.  
  5454. 3.3.2 Looking at the contents of directories
  5455.  
  5456. Now that you know how  to move around directories you  probably think,
  5457. ``So what?''  The basic  skill of moving around directories  is fairly
  5458. useless, so let's introduce a new command, ls.  ls prints a listing of
  5459. files and directories, by  default from your  current directory.   For
  5460. example:
  5461. 3.3.  First Steps into UNIX                                         94
  5462. _______________________________________________________________________
  5463.  
  5464.     /home/larry# ls
  5465.     Mail
  5466.     letters
  5467.     papers
  5468.     /home/larry#
  5469.  
  5470.   Here  we  can see  that  Larry  has  three entries  in  his  current
  5471. directory:   Mail,  letters,  and  papers.     This  doesn't  tell  us
  5472. much---are these directories or files?   We can  use the -F option  on
  5473. the ls command to tell us more.
  5474.  
  5475.     /home/larry# ls --F
  5476.     Mail/
  5477.     letters/
  5478.     papers/
  5479.     /home/larry#
  5480.  
  5481.  
  5482. From the / appended to each filename, we know that these three entries
  5483. are in fact subdirectories.
  5484.   Using ls -F may  also append ``*'' to the  end of a filename.   This
  5485. indicates that the file  is an executable, or  a program which can  be
  5486. run.  If  nothing is appended  to the filename  using ls -F, the  file
  5487. is a ``plain  old file'',  that is,  it's neither a  directory, or  an
  5488. executable.
  5489.   In  general, each  UNIX command  may  take a  number  of options  in
  5490. addition to  other arguments.    These options  usually  begin with  a
  5491. ``-'', as demonstrated  above with ls  -F. The -F  option tells ls  to
  5492. give more information about the  type of the files involved---in  this
  5493. case, printing a / after each directory name.
  5494.   If you give ls a directory name, it will print  the contents of that
  5495. directory.
  5496.  
  5497.     /home/larry# ls --F papers
  5498.     english-lit
  5499.     history-final
  5500.     masters-thesis
  5501.     notes/
  5502.     /home/larry#
  5503.  
  5504.   Or,  for  a  more interesting  listing,  let's  see  what's  in  the
  5505. system's /etc directory.
  5506.  
  5507.  
  5508.     /home/larry# ls /etc
  5509.  
  5510.  
  5511.     Images       ftpusers     lpc          rc.new       shells
  5512.     adm          getty        magic        rc0.d        startcons
  5513.     bcheckrc     gettydefs    motd         rc1.d        swapoff
  5514.  
  5515. 3.3.   First Steps into UNIX                                        95
  5516. _______________________________________________________________________
  5517.  
  5518.     brc          group        mount        rc2.d        swapon
  5519.     brc~         inet         mtab         rc3.d        syslog.conf
  5520.     csh.cshrc    init         mtools       rc4.d        syslog.pid
  5521.     csh.login    init.d       pac          rc5.d        syslogd.reload
  5522.     default      initrunlvl   passwd       rmt          termcap
  5523.     disktab      inittab      printcap     rpc          umount
  5524.     fdprm        inittab.old  profile      rpcinfo      update
  5525.     fstab        issue        psdatabase   securetty    utmp
  5526.     ftpaccess    lilo         rc           services     wtmp
  5527.     /home/larry#
  5528.  
  5529.  
  5530.  
  5531.   (For those MS-DOS users  out there, notice how the filenames  can be
  5532. longer than 8 characters, and can contain periods in any position.  It
  5533. is even possible to have more than one period in a filename.)
  5534.   Let's cd up to the  top of the directory tree, using ``cd  ..'', and
  5535. then down to another directory:  /usr/bin.
  5536.  
  5537.     /home/larry# cd ..
  5538.     /home# cd ..
  5539.     /# cd usr
  5540.     /usr# cd bin
  5541.     /usr/bin#
  5542.  
  5543. You can  also  move into  directories  in  multiple steps,  as  in  cd
  5544. /usr/bin.
  5545.   Try moving  around various directories,  using ls and cd.   In  some
  5546. cases, you  may  run into  a  foreboding ``Permission  denied''  error
  5547. message.  This is simply the concept of UNIX security kicking  in:  in
  5548. order to ls or to cd into a directory, you must have  permission to do
  5549. so.  We'll talk more about this in   Section 3.9.
  5550.  
  5551.  
  5552. 3.3.3 Creating new directories
  5553.  
  5554. It's time to learn how to  create directories.  This involves  the use
  5555. of the mkdir command.  Try the following:
  5556.  
  5557.     /home/larry# mkdir foo
  5558.     /home/larry# ls -F
  5559.     Mail/
  5560.     foo/
  5561.     letters/
  5562.     papers/
  5563.     /home/larry# cd foo
  5564.     /home/larry/foo# ls
  5565.    3.3.   First Steps into UNIX                                        96
  5566.    _______________________________________________________________________
  5567.  
  5568.        /home/larry/foo#
  5569.  
  5570.      Congrats!   You've  just made  a new  directory and  moved into  it.
  5571.    Since there aren't any files in this new directory, let's learn how to
  5572.    copy files from one place to another.
  5573.  
  5574.    3.3.4 Copying files
  5575.  
  5576.    Copying files is done with the command cp:
  5577.  
  5578.  
  5579.        /home/larry/foo# cp /etc/termcap  .
  5580.        /home/larry/foo# cp /etc/shells  .
  5581.        /home/larry/foo# ls --F
  5582.        shells     termcap
  5583.        /home/larry/foo# cp shells bells
  5584.        /home/larry/foo# ls --F
  5585.        bells     shells     termcap
  5586.        /home/larry/foo#
  5587.  
  5588.      The cp command  copies the files listed  on the command line to  the
  5589.    file or directory given as the last  argument.  Notice how we  use the
  5590.    directory ``.''  to refer to the current directory.
  5591.  
  5592.    3.3.5 Moving files
  5593.  
  5594.    A new command  named mv moves  files, instead  of copying  them.   The
  5595.    syntax is very straightforward.
  5596.  
  5597.        /home/larry/foo# mv termcap sells
  5598.        /home/larry/foo# ls -F
  5599.        bells     sells     shells
  5600.        /home/larry/foo#
  5601.  
  5602.      Notice how termcap  no longer exists, but  in its place is the  file
  5603.    sells.  This can  be used to rename files,  as we have just done,  but
  5604.    also to move a file to a completely new directory.
  5605. !    Note:  mv and cp will overwrite the destination  file (if it already
  5606.    exists) without asking  you.   Be careful  when you  move a file  into
  5607.    another directory:  there may already be a file with the  same name in
  5608.    that directory, which you'll overwrite!
  5609.  
  5610.    3.3.6 Deleting files and directories
  5611.  
  5612.    You now have an ugly rhyme developing with the use of  the ls command.
  5613.    To delete a file, use the rm command.  (``rm'' stands for ``remove'').
  5614.  
  5615.  
  5616.        /home/larry/foo# rm bells sells
  5617.        /home/larry/foo# ls -F
  5618. 3.3.   First Steps into UNIX                                        97
  5619. _______________________________________________________________________
  5620.  
  5621.     shells
  5622.     /home/larry/foo#
  5623.  
  5624.   We're left  with nothing but shells,  but we won't  complain.   Note
  5625. that rm by  default won't prompt  you before  deleting a file---so  be
  5626. careful.
  5627.   A  related  command  to  rm is  rmdir.     This  command  deletes  a
  5628. directory, but  only if  the directory  is empty.    If the  directory
  5629. contains any files or subdirectories, rmdir will complain.
  5630.  
  5631. 3.3.7 Looking at files
  5632.  
  5633. The commands more and cat are used for viewing the  contents of files.
  5634. more displays a file, one screenful at a time, while  cat displays the
  5635. whole file at once.
  5636.   To look at the file shells, we can use the command
  5637.  
  5638.     /home/larry/foo# more shells
  5639.  
  5640.   In case  you're  interested what  shells contains,  it's  a list  of
  5641. valid shell programs on your system.   On most systems,  this includes
  5642. /bin/sh, /bin/bash, and  /bin/csh.  We'll  talk about these  different
  5643. types of shells later.
  5644.   While using more,  press [Space] to display  the next page of  text,
  5645. and [b]  to display  the  previous page.    There  are other  commands
  5646. available in more as well,  these are just  the basics.  Pressing  [q]
  5647. will quit more.
  5648.   Quit more and try cat  /etc/termcap.  The text will probably  fly by
  5649. much too quickly for you to read it.  The name ``cat'' actually stands
  5650. for ``concatenate'', which is  the real use of  the program.  The  cat
  5651. command can be used to  concatenate the contents of several  files and
  5652. save the result to another file.  This will be discussed later.
  5653.  
  5654.  
  5655. 3.3.8 Getting online help
  5656.  
  5657. Almost every UNIX  system, Linux included,  provides a facility  known
  5658. as ``manual pages'',  or ``man  pages'' for  short.   These man  pages
  5659. contain online documentation for all  of the various system  commands,
  5660. resources, configuration files, and so on.
  5661.   The command  used to  access man  pages  is man.    For example,  if
  5662. you're interested in  finding out about  the other  options of the  ls
  5663. command, you can type
  5664.  
  5665.     /home/larry# man ls
  5666.  
  5667. and the man page for ls will be displayed.
  5668.   Unfortunately,  most of  the man  pages out  there  are written  for
  5669. those who already have some idea of what the command or resource does.
  5670. For this reason, man pages usually only contain the hardcore technical
  5671. details of the command, without a lot of tutorial.  However, man pages
  5672. 3.4.   Summary of Basic Commands                                    98
  5673. _______________________________________________________________________
  5674.  
  5675. can be an invaluable  resource for jogging  your memory if you  forget
  5676. the syntax of a command.  Man pages will also tell you a lot about the
  5677. commands which we won't tell you in this book.
  5678.   I suggest  that  you try  man for  the commands  we've already  gone
  5679. over, and whenever  I introduce  a new  command.   You'll notice  some
  5680. of these commands won't  have man pages.   This  could be for  several
  5681. reasons.  For one, the  man pages haven't been written yet  (the Linux
  5682. Documentation Project  is responsible  for man  pages  under Linux  as
  5683. well.  We are gradually  accumulating most of the man  pages available
  5684. for the system).  Secondly, the the command might be an internal shell
  5685. command, or an alias (as discussed in Section 3.2.4), in which case it
  5686. would not have a man page of its  own.  One example is cd, which  is a
  5687. shell internal command.   The shell actually processes the  cd---there
  5688. is no separate program which contains this command.
  5689.  
  5690.  
  5691. 3.4 Summary of Basic Commands
  5692.  
  5693. This section introduces some  of the most  useful basic commands on  a
  5694. UNIX system, including those covered in the last section.
  5695.   Note that  options usually  begin with a  ``-'', and  in most  cases
  5696. multiple one-letter options may be combined using a single ``-''.  For
  5697. example, instead of using the command ls -l -F, it is  adequate to use
  5698. ls -lF.
  5699.   Instead of listing  all of the options  available for each of  these
  5700. commands, we'll only  talk about those which  are useful or  important
  5701. at this time.   In fact,  most of these  commands have a large  number
  5702. of options (most of which you'll never  use).  You can use man  to see
  5703. the manual pages  for each command,  which list  all of the  available
  5704. options.
  5705.   Also note  that  many of  these commands  take a  list  of files  or
  5706. directories as  arguments,  denoted by  ``<file1> ... <fileN>''.   For
  5707. example, the cp command  takes as arguments a  list of files to  copy,
  5708. followed by the destination file or directory.  When copying more than
  5709. one file, the destination must be a directory.
  5710. cd         Change the current working directory.
  5711.            Syntax:  cd <directory>
  5712.            <directory> is the  directory to change to.  (``.''  refers
  5713.            to the current directory, ``..''  the parent directory.)
  5714.            Example:  cd ../foo sets the current directory to ../foo.
  5715.  
  5716. ls         Displays  information about  the named  files and  directo-
  5717.            ries.
  5718.            Syntax:  ls <file1> <file2> ... <fileN>
  5719.            Where   <file1>  through  <fileN>   are  the   filenames  or
  5720.            directories  to list.   Options:   There  are more  options
  5721.            than you want  to think about.  The most commonly  used are
  5722.            -F (used to display some information  about the type of the
  5723.            file),  and -l  (gives  a ``long''  listing including  file
  5724.            size, owner, permissions, and so on.   This will be covered
  5725. 3.4.   Summary of Basic Commands                                    99
  5726. _______________________________________________________________________
  5727.  
  5728.            in detail later.)
  5729.            Example:   ls -lF /home/larry will display the  contents of
  5730.            the directory /home/larry.
  5731.  
  5732. cp         Copies file(s) to another file or directory.
  5733.            Syntax:  cp <file1> <file2> ... <fileN> <destination>
  5734.            Where  <file1> through  <fileN> are the  files to  copy, and
  5735.            <destination> is the destination file or directory.
  5736.            Example:   cp ../frog  joe copies the  file ../frog to  the
  5737.            file or directory joe.
  5738.  
  5739. mv         Moves file(s)  to another file or directory.   This command
  5740.            does the  equivalent of a copy followed by the  deletion of
  5741.            the original.  This can be used  to rename files, as in the
  5742.            MS-DOS command RENAME.
  5743.            Syntax:  mv <file1> <file2> ... <fileN> <destination>
  5744.            Where  <file1> through  <fileN> are the  files to  move, and
  5745.            <destination> is the destination file or directory.
  5746.            Example:   mv  ../frog joe moves  the file  ../frog to  the
  5747.            file or directory joe.
  5748.  
  5749. rm         Deletes  files.   Note that  when files  are deleted  under
  5750.            UNIX, they are unrecoverable (unlike  MS-DOS, where you can
  5751.            usually ``undelete'' the file).
  5752.            Syntax:  rm <file1> <file2> ... <fileN>
  5753.            Where <file1> through <fileN> are the filenames to delete.
  5754.            Options:   -i will prompt for confirmation  before deleting
  5755.            the file.
  5756.            Example:   rm -i  /home/larry/joe /home/larry/frog  deletes
  5757.            the files joe and frog in /home/larry.
  5758.  
  5759. mkdir      Creates new directories.
  5760.            Syntax:  mkdir <dir1> <dir2> ... <dirN>
  5761.            Where <dir1> through <dirN> are the directories to create.
  5762.            Example:    mkdir /home/larry/test  creates  the  directory
  5763.            test under /home/larry.
  5764. rmdir      This command deletes empty directories.   When using rmdir,
  5765.            your  current  working directory  must  not be  within  the
  5766.            directory to be deleted.
  5767.            Syntax:  rmdir <dir1> <dir2> ... <dirN>
  5768.            Where <dir1> through <dirN> are the directories to delete.
  5769.            Example:   rmdir /home/larry/papers  deletes the  directory
  5770.            /home/larry/papers, if it is empty.
  5771.  
  5772. man        Displays the manual page for the  given command or resource
  5773.            (that is,  any system utility  which isn't a command,  such
  5774.            as a library function.)  Syntax:  man <command>
  5775.            Where <command>  is the name of  the command or resource to
  5776.            get help on.
  5777.            Example:  man ls gives help on the ls command.
  5778. 3.5.   Exploring the File System                                   100
  5779. _______________________________________________________________________
  5780.  
  5781. more       Displays the contents of the named  files, one screenful at
  5782.            a time.
  5783.            Syntax:  more <file1> <file2> ... <fileN>
  5784.            Where <file1> through <fileN> are the files to display.
  5785.            Example:    more  papers/history-final  displays  the  file
  5786.            papers/history-final.
  5787.  
  5788. cat        Officially used  to concatenate files, cat is also  used to
  5789.            display the entire contents of a file at once.
  5790.            Syntax:  cat <file1> <file2> ... <fileN>
  5791.            Where <file1> through <fileN> are the files to display.
  5792.            Example:      cat  letters/from-mdw   displays   the   file
  5793.            letters/from-mdw.
  5794.  
  5795. echo       Simply echoes the given arguments.
  5796.            Syntax:  echo <arg1> <arg2> ... <argN>
  5797.            Where <arg1> through <argN> are the arguments to echo.
  5798.            Example:   echo "Hello world"  displays the string  ``Hello
  5799.            world''.
  5800.  
  5801. grep       Display all of the lines in  the named file(s) matching the
  5802.            given pattern.
  5803.            Syntax:  grep <pattern> <file1> <file2> ... <fileN>
  5804.            Where  <pattern>  is  a  regular  expression  pattern,  and
  5805.            <file1> through <fileN> are the files to search.
  5806.            Example:  grep loomer /etc/hosts will  display all lines in
  5807.            the file /etc/hosts which contain the pattern ``loomer''.
  5808.  
  5809.  
  5810. 3.5 Exploring the File System
  5811.  
  5812. The file  system is  the  collection of  files  and the  hierarchy  of
  5813. directories on your system.   I promised  before to escort you  around
  5814. the filesystem and the time has come.
  5815.   You have the skills and the knowledge to make sense  out of what I'm
  5816. saying, and you have a roadmap.  (Refer to Figure 3.2.8 on page 91).
  5817.   First, change to the root directory (cd /), and do  an ls -F. You'll
  5818. probably see these directories(2):  bin, dev, etc, home, install, lib,
  5819. mnt, proc, root, tmp, user, usr, and var.
  5820.   Let's take a look at each of these directories.
  5821.  
  5822. /bin       /bin is  short for ``binaries'', or  executables.  This  is
  5823.            where  many essential  system  programs reside.    Use  the
  5824.            command  ``ls -F /bin''  to list the  files here.   If  you
  5825.            look  down the list  you may  see a few  commands that  you
  5826.            recognize, such  as cp, ls, and  mv.  These are  the actual
  5827.  
  5828. ----------------------------
  5829.  2. You may  see others, and  you might not  see all of  them.   Don't
  5830. worry.  Every release of Linux differs in some respects.
  5831. 3.5.   Exploring the File System                                   101
  5832. _______________________________________________________________________
  5833.  
  5834.            programs for these commands.  When  you use the cp command,
  5835.            you're running the program /bin/cp.
  5836.  
  5837.            Using  ls -F,  you'll see  that most  (if not  all) of  the
  5838.            files in  /bin have an  asterisk (``*'') appended to  their
  5839.            filenames.  This indicates that  the files are executables,
  5840.            as described in Section 3.3.2.
  5841. /dev       Next on our stop is /dev.  Take a look, again with ls -F.
  5842.  
  5843.            The  ``files'' in /dev are  known as device  drivers---they
  5844.            are used  to access system  devices and resources, such  as
  5845.            disk drives, modems, memory, and so on.   For example, just
  5846.            as you can  read data from a file, you can read  input from
  5847.            the mouse by accessing /dev/mouse.
  5848.            The  filenames beginning with fd  are floppy disk  devices.
  5849.            fd0 is the  first floppy disk drive, fd1 the second.   Now,
  5850.            the  astute  among you  will  notice  that there  are  more
  5851.            floppy disk  devices then just  the two I've listed  above:
  5852.            they  represent  specific  types  of floppy  disks.     For
  5853.            example, fd1H1440 will access  high-density, 3.5" diskettes
  5854.            in drive 1.
  5855.  
  5856.            Here  is a list of  some of the  most commonly used  device
  5857.            files.   Note  that even though  you may  not have some  of
  5858.            the devices listed below, the chances  are that you'll have
  5859.            entries in /dev for them anyway.
  5860.  
  5861.              o /dev/console refers to the  system's console---that is,
  5862.                the monitor connected directly to your system.
  5863.  
  5864.              o The  various /dev/ttyS  and /dev/cua  devices are  used
  5865.                for  accessing serial ports.   For example,  /dev/ttyS0
  5866.                refers to  ``COM1'' under MS-DOS. The  /dev/cua devices
  5867.                are ``callout'' devices, which  are used in conjunction
  5868.                with a modem.
  5869.  
  5870.              o The device names beginning with  hd access hard drives.
  5871.                /dev/hda  refers to  the whole first  hard disk,  while
  5872.                hda1 refers to the first partition on /dev/hda.
  5873.  
  5874.              o The  device names  beginning with sd  are SCSI  drives.
  5875.                If  you have a  SCSI hard  drive, instead of  accessing
  5876.                it through  /dev/hda, you would access /dev/sda.   SCSI
  5877.                tapes are accessed via st  devices, and SCSI CD-ROM via
  5878.                sr devices.
  5879.  
  5880.              o The  device  names beginning  with lp  access  parallel
  5881.                ports.    /dev/lp0  refers to  ``LPT1''  in the  MS-DOS
  5882.                world.
  5883. 3.5.   Exploring the File System                                   102
  5884. _______________________________________________________________________
  5885.  
  5886.              o /dev/null is  used as a ``black hole''---any  data sent
  5887.                to this  device is gone forever.   Why is this  useful?
  5888.                Well,  if  you  wanted  to suppress  the  output  of  a
  5889.                command appearing  on your screen, you could  send that
  5890.                output  to  /dev/null.    We'll  talk more  about  this
  5891.                later.
  5892.  
  5893.              o The device  names beginning with /dev/tty refer  to the
  5894.                ``virtual  consoles'' on your  system (accessed via  by
  5895.                pressing  [alt-F1], [alt-F2],  and so on).    /dev/tty1
  5896.                refers  to  the  first  VC,  /dev/tty2  refers  to  the
  5897.                second, and so on.
  5898.  
  5899.              o The device names beginning  with /dev/pty are ``pseudo-
  5900.                terminals''.   They are used to provide  a ``terminal''
  5901.                to  remote  login  sessions.    For  example,  if  your
  5902.                machine is  on a network, incoming telnet  logins would
  5903.                use one of the /dev/pty devices.
  5904.  
  5905.  
  5906. /etc       /etc  contains a  number  of miscellaneous  system  config-
  5907.            uration  files.     These  include  /etc/passwd  (the  user
  5908.            database), /etc/rc (the system  initialization script), and
  5909.            so on.
  5910.  
  5911. /sbin      sbin is  used for storing essential system binaries,  to be
  5912.            used by the system administrator.
  5913.  
  5914. /home      /home  contains  user's home  directories.    For  example,
  5915.            /home/larry is  the home directory for the  user ``larry''.
  5916.            On a newly-installed system, there may  not be any users in
  5917.            this directory.
  5918.  
  5919. /lib       /lib contains  shared library images.  These  files contain
  5920.            code which many programs share in common.   Instead of each
  5921.            program containing  its own copy of these  shared routines,
  5922.            they are  all stored in  one common place,  in /lib.   This
  5923.            makes  executable files smaller,  and saves  space on  your
  5924.            system.
  5925.  
  5926. /proc      /proc is  a ``virtual filesystem'', the files in  which are
  5927.            stored  in memory, not  on the  drive.   They refer to  the
  5928.            various  processes running  on the  system,  and allow  you
  5929.            to  get information about what  programs and processes  are
  5930.            running at  any given time.   We'll go into more  detail in
  5931.            Section 3.11.1.
  5932. /tmp       Many programs have a need to  generate some information and
  5933.            store it in  a temporary file.  The canonical  location for
  5934.            these files is in /tmp.
  5935. 3.5.   Exploring the File System                                   103
  5936. _______________________________________________________________________
  5937.  
  5938. /usr       /usr is a  very important directory.  It contains  a number
  5939.            of subdirectories  which in turn  contain some of the  most
  5940.            important and useful programs and  configuration files used
  5941.            on the system.
  5942.  
  5943.            The various  directories described above are  essential for
  5944.            the  system  to  operate,  but most  of  the  things  found
  5945.            in  /usr are  optional  for the  system.   However,  it  is
  5946.            those  optional things  which make  the  system useful  and
  5947.            interesting.    Without /usr,  you'd  more or  less have  a
  5948.            boring  system, only with  programs like cp and  ls.   /usr
  5949.            contains  most  of the  larger  software packages  and  the
  5950.            configuration files which accompany them.
  5951. /usr/X386  /usr/X386  contains The X Window  System, if you  installed
  5952.            it.   The X  Window System is  a large, powerful  graphical
  5953.            environment  which provides  a  large number  of  graphical
  5954.            utilities  and programs, displayed  in ``windows'' on  your
  5955.            screen.    If you're  at  all familiar  with the  Microsoft
  5956.            Windows  or Macintosh  environments,  X Windows  will  look
  5957.            very  familiar.    The  /usr/X386  directory  contains  all
  5958.            of  the X  Windows  executables, configuration  files,  and
  5959.            support  files.   This will  be covered in  more detail  in
  5960.            Section 5.1.
  5961.  
  5962. /usr/bin   /usr/bin  is the real  warehouse for  software on any  UNIX
  5963.            system.   It contains most of the executables  for programs
  5964.            not found in other places, such as /bin.
  5965.  
  5966. /usr/etc   Just  as /etc contained  miscellaneous system programs  and
  5967.            configuration files,  /usr/etc contains even more  of these
  5968.            utilities  and files.    In  general,  the files  found  in
  5969.            /usr/etc  are not  essential to  the system,  unlike  those
  5970.            found in /etc, which are.
  5971.  
  5972. /usr/include
  5973.            /usr/include  contains include  files for  the C  compiler.
  5974.            These  files (most  of  which end  in .h,  for  ``header'')
  5975.            declare  data structure names,  subroutines, and  constants
  5976.            used  when writing  programs  in C.  Those files  found  in
  5977.            /usr/include/sys  are generally  used  when programming  on
  5978.            the  UNIX system level.   If  you are  familiar with the  C
  5979.            programming  language, here you'll  find header files  such
  5980.            as stdio.h, which declares functions such as printf().
  5981.  
  5982. /usr/g++-include
  5983.            /usr/g++-include  contains   include  files  for  the   C++
  5984.            compiler (much like /usr/include).
  5985.  
  5986. /usr/lib   /usr/lib  contains  the  ``stub''  and  ``static''  library
  5987.            equivalents  to the files  found in /lib.   When  compiling
  5988.            a  program, the  program is ``linked''  with the  libraries
  5989. 3.5.   Exploring the File System                                   104
  5990. _______________________________________________________________________
  5991.  
  5992.            found in  /usr/lib, which then directs the program  to look
  5993.            in /lib when  it needs the actual code in the library.   In
  5994.            addition, various other programs  store configuration files
  5995.            in /usr/lib.
  5996.  
  5997. /usr/local /usr/local  is  a  lot  like   /usr---it  contains  various
  5998.            programs and  files not essential to the system,  but which
  5999.            make  the system  fun  and exciting.    In  general,  those
  6000.            programs  found  in  /usr/local are  specialized  for  your
  6001.            system specifically---that  is, /usr/local differs  greatly
  6002.            between UNIX systems.
  6003.            Here,  you'll  find large  software  packages such  as  TeX
  6004.            (a  document  formatting system)  and  Emacs (a  large  and
  6005.            powerful editor), if you installed them.
  6006.  
  6007. /usr/man   This directory  contains the actual man  pages.  There  are
  6008.            two subdirectories for every man  page ``section'' (use the
  6009.            command man  man for details).  For  example, /usr/man/man1
  6010.            contains  the source  (that is,  the unformatted  original)
  6011.            for man pages in section 1,  and /usr/man/cat1 contains the
  6012.            formatted man pages for section 1.
  6013.  
  6014. /usr/src   /usr/src contains the source code  (the uncompiled program)
  6015.            for various  programs on your system.   The most  important
  6016.            thing  here is  /usr/src/linux, which  contains the  source
  6017.            code for the Linux kernel.
  6018.  
  6019. /var       /var holds  directories that often  change in size or  tend
  6020.            to  grow.   Many  of those  directories used  to reside  in
  6021.            /usr,  but  since  we  are trying  to  keep  it  relatively
  6022.            unchangeable, the  directories that change often  have been
  6023.            moved to /var.  Some of those directories are:
  6024.  
  6025. /var/adm   /var/adm contains  various files of interest to  the system
  6026.            administrator, specifically  system logs, which record  any
  6027.            errors  or problems with  the system.   Other files  record
  6028.            logins  to the system,  as well  as failed login  attempts.
  6029.            This will be covered in Chapter 4.
  6030.  
  6031. /var/spool /var/spool  contains  files  which are  to  be  ``spooled''
  6032.            to  another program.    For  example,  if your  machine  is
  6033.            connected  to a network,  incoming mail  will be stored  in
  6034.            /var/spool/mail, until you read it or  delete it.  Outgoing
  6035.            or incoming news articles may  be found in /var/spool/news,
  6036.            and so on.
  6037. 3.6.   Types of shells                                             105
  6038. _______________________________________________________________________
  6039.  
  6040. 3.6 Types of shells
  6041.  
  6042. As I have  mentioned too many  times before,  UNIX is a  multitasking,
  6043. multiuser operating system.  Multitasking is very useful, and once you
  6044. get used to it, you'll  use it all of the  time.  Before long,  you'll
  6045. be able to run programs in the ``background'', switch between multiple
  6046. tasks,  and ``pipeline''  programs  together  to  achieve  complicated
  6047. results with a single command.
  6048.   Many of the features we'll be covering in  this section are features
  6049. provided by  the  shell  itself.    Be  careful not  to  confuse  UNIX
  6050. (the actual operating system)  with the shell---the  shell is just  an
  6051. interface to the underlying system.   The shell provides a  great deal
  6052. of functionality on top of UNIX itself.
  6053.   The shell is not only an interpreter for  your interactive commands,
  6054. which you type  at the  prompt.   It  is also  a powerful  programming
  6055. language, which  allows  you  to write  shell  scripts,  to  ``batch''
  6056. several shell  commands  together  in  a  file.    MS-DOS  users  will
  6057. recognize the similarity to ``batch files''.  Use of  shell scripts is
  6058. a very powerful tool, which will allow you to automate and expand your
  6059. usage of UNIX. See Section 3.13.1 for more information.
  6060.   There are several types of shells in the UNIX world.   The two major
  6061. types are the ``Bourne shell'' and the ``C shell''.   The Bourne shell
  6062. uses a command syntax like  the original shell on early  UNIX systems,
  6063. such as System III. The name of the Bourne shell on  most UNIX systems
  6064. is /bin/sh (where sh stands  for ``shell'').   The C shell (not to  be
  6065. confused with sea shell)  uses a different  syntax, somewhat like  the
  6066. programming language C, and on most UNIX systems is named /bin/csh.
  6067.   Under  Linux,   there  are  several   variations  of  these   shells
  6068. available.  The two most commonly used are the Bourne  Again Shell, or
  6069. ``Bash'' (/bin/bash), and  Tcsh (/bin/tcsh).   Bash is  a form of  the
  6070. Bourne shell with many of the advanced features found in  the C shell.
  6071. Because Bash supports a superset of the Bourne shell syntax, any shell
  6072. scripts written in the  standard Bourne shell  should work with  Bash.
  6073. For those who prefer to use  the C shell syntax, Linux  supports Tcsh,
  6074. which is an expanded version of the original C shell.
  6075.   The type  of shell  that you  decide to  use is  mostly a  religious
  6076. issue.  Some  folks prefer the Bourne  shell syntax with the  advanced
  6077. features of Bash, and some prefer the more structured  C shell syntax.
  6078. As far as normal commands, such as cp and ls, are  concerned, the type
  6079. of shell you're using doesn't matter---the  syntax is the same.   Only
  6080. when you start  to write  shell scripts  or use some  of the  advanced
  6081. features of the shell do the differences between shell types  begin to
  6082. matter.
  6083.   As we're discussing some of the features of the  shell, below, we'll
  6084. note those differences between Bourne and C shells.  However,  for the
  6085. purposes of this manual, most of  those differences are minimal.   (If
  6086. you're really curious at this point,  read the man pages for  bash and
  6087. tcsh).
  6088. 3.7.   Wildcards                                                   106
  6089. _______________________________________________________________________
  6090.  
  6091. 3.7 Wildcards
  6092.  
  6093. A key feature  of most Unix  shells is the  ability to reference  more
  6094. than one filename using special characters.  These so-called wildcards
  6095. allow you to refer to, say, all filenames which  contain the character
  6096. ``n''.
  6097.   The wildcard ``*'' refers  to any character or string  of characters
  6098. in a filename.   For example,  when you use  the character ``*'' in  a
  6099. filename, the shell replaces  it with all possible substitutions  from
  6100. filenames in the directory which you're referencing.
  6101.   Here's a  quick example.   Let's  suppose that  Larry has the  files
  6102. frog, joe, and stuff in his current directory.
  6103.  
  6104.     /home/larry# ls
  6105.     frog     joe     stuff
  6106.     /home/larry#
  6107.  
  6108.   To access all  files with the letter  ``o'' in the filename, we  can
  6109. use the command
  6110.  
  6111.     /home/larry# ls *o*
  6112.     frog     joe
  6113.     /home/larry#
  6114.  
  6115. As you can see,  the use of the  ``*'' wildcard was replaced with  all
  6116. substitutions which matched the wildcard from filenames in the current
  6117. directory.
  6118.   The use  of ``*'' by  itself simply  matches all filenames,  because
  6119. all characters match the wildcard.
  6120.  
  6121.     /home/larry# ls *
  6122.     frog     joe     stuff
  6123.     /home/larry#
  6124.  
  6125.   Here are a few more examples.
  6126.  
  6127.     /home/larry# ls f*
  6128.     frog
  6129.     /home/larry# ls *ff
  6130.     stuff
  6131.     /home/larry# ls *f*
  6132.     frog     stuff
  6133.     /home/larry# ls s*f
  6134.     stuff
  6135.     /home/larry#
  6136.  
  6137.   The process of  changing a ``*''  into filenames is called  wildcard
  6138. expansion and  is  done  by the  shell.     This is  important:    the
  6139. individual commands, such as ls, never see the ``*'' in  their list of
  6140. parameters.   The shell  expands the  wildcard to include  all of  the
  6141. 3.7.   Wildcards                                                   107
  6142. _______________________________________________________________________
  6143.  
  6144. filenames which match.  So, the command
  6145.  
  6146.     /home/larry# ls *o*
  6147.  
  6148. is expanded by the shell to actually be
  6149.  
  6150.     /home/larry# ls frog joe
  6151.  
  6152.   One important note  about the ``*'' wildcard.   Using this  wildcard
  6153. will not match  filenames which  begin with a  single period  (``.'').
  6154. These files  are  treated as  ``hidden''  files---while they  are  not
  6155. really hidden, they don't  show up on  normal ls listings, and  aren't
  6156. touched by the use of the ``*'' wildcard.
  6157.   Here's an  example.   We already mentioned  that each directory  has
  6158. two special entries in it:   ``.''   refers to the current  directory,
  6159. and ``..''  refers to the parent directory.  However, when you use ls,
  6160. these two entries don't show up.
  6161.  
  6162.     /home/larry# ls
  6163.     frog     joe     stuff
  6164.     /home/larry#
  6165.  
  6166. If you use the -a switch  with ls, however, you can  display filenames
  6167. which begin with ``.''.  Observe:
  6168.  
  6169.     /home/larry# ls -a
  6170.     .      ..      .bash_profile      .bashrc      frog        joe
  6171.     stuff
  6172.     /home/larry#
  6173.  
  6174. Now we can see  the two special  entries, ``.''   and ``..'', as  well
  6175. as two other ``hidden'' files---.bash_profile and .bashrc.   These two
  6176. files are startup files used by bash when larry logs in.  More on them
  6177. in Section 3.13.3.
  6178.   Note that  when we  use the ``*''  wildcard, none  of the  filenames
  6179. beginning with ``.''  are displayed.
  6180.  
  6181.     /home/larry# ls *
  6182.     frog     joe     stuff
  6183.     /home/larry#
  6184.  
  6185. This is a  safety feature:   if the  ``*'' wildcard matched  filenames
  6186. beginning with ``.'',  it would also match  the directory names  ``.''
  6187. and ``..''.  This can be dangerous when using certain commands.
  6188.   Another wildcard  is ``?''.   The ``?''   wildcard will only  expand
  6189. a single character.   Thus, ``ls ?''   will display all one  character
  6190. filenames, and  ``ls termca?''    would  display  ``termcap'' but  not
  6191. ``termcap.backup''.  Here's another example:
  6192.  
  6193.     /home/larry# ls j?e
  6194. 3.8.   UNIX Plumbing                                               108
  6195. _______________________________________________________________________
  6196.  
  6197.     joe
  6198.     /home/larry# ls f??g
  6199.     frog
  6200.     /home/larry# ls ????f
  6201.     stuff
  6202.     /home/larry#
  6203.  
  6204.   As you  can see, wildcards  allow you to specify  many files at  one
  6205. time.  In  the simple command  summary, in Section  3.4, we said  that
  6206. the cp and mv commands actually can copy or move multiple files at one
  6207. time.  For example,
  6208.  
  6209.     /home/larry# cp /etc/s* /home/larry
  6210.  
  6211. will copy all filenames in /etc beginning with ``s'' to  the directory
  6212. /home/larry.  Therefore, the format of the cp command is really
  6213.  
  6214.     cp <file1> <file2> <file3> ... <fileN> <destination>
  6215.  
  6216. where <file1>  through <fileN>  is a  list  of filenames  to copy,  and
  6217. <destination> is the  destination file or  directory to  copy them to.
  6218. mv has an identical syntax.
  6219.   Note that  if you  are copying  or moving  more than  one file,  the
  6220. <destination> must be a directory.  You can only copy or move a single
  6221. file to another file.
  6222.  
  6223.  
  6224. 3.8 UNIX Plumbing
  6225.  
  6226. 3.8.1 Standard input and output
  6227.  
  6228. Many UNIX commands get input from what is known as  standard input and
  6229. send their output to standard  output (often abbreviated as  ``stdin''
  6230. and ``stdout'').  Your shell sets things up so that  standard input is
  6231. your keyboard, and standard output is the screen.
  6232.   Here's an example using  the command cat.  Normally, cat  reads data
  6233. from all of  the filenames given  on the command  line and sends  this
  6234. data directly to stdout.  Therefore, using the command
  6235.  
  6236.     /home/larry/papers# cat history-final masters-thesis
  6237.  
  6238. will display  the  contents  of  the file  history-final  followed  by
  6239. masters-thesis.
  6240.   However, if no filenames are given to cat as  parameters, it instead
  6241. reads data  from stdin,  and  sends it  back  to stdout.    Here's  an
  6242. example.
  6243.  
  6244.     /home/larry/papers# cat
  6245.     Hello there.
  6246.     Hello there.
  6247. 3.8.   UNIX Plumbing                                               109
  6248. _______________________________________________________________________
  6249.  
  6250.     Bye.
  6251.     Bye.
  6252.     [ctrl-D]
  6253.     /home/larry/papers#
  6254.  
  6255. As you can see, each line  that the user types (displayed  in italics)
  6256. is immediately echoed  back by  the cat  command.   When reading  from
  6257. standard input, commands know that the input is ``finished'' when they
  6258. receive an EOT (end-of-text) signal.  In general, this is generated by
  6259. pressing [ctrl-D].
  6260.   Here's another  example.   The command sort reads  in lines of  text
  6261. (again, from stdin, unless files  are given on the command line),  and
  6262. sends the sorted output to stdout.  Try the following.
  6263.  
  6264.     /home/larry/papers# sort
  6265.     bananas
  6266.     carrots
  6267.     apples
  6268.     [ctrl-D]
  6269.     apples
  6270.     bananas
  6271.     carrots
  6272.     /home/larry/papers#
  6273.  
  6274. Now we can alphabetize our shopping list...  isn't UNIX useful?
  6275.  
  6276. 3.8.2 Redirecting input and output
  6277.  
  6278. Now, let's say that we  wanted to send the  output of sort to a  file,
  6279. to save our shopping list elsewhere.  The shell allows  us to redirect
  6280. standard output to a filename, using the ``>'' symbol.   Here's how it
  6281. works.
  6282.  
  6283.     /home/larry/papers# sort > shopping-list
  6284.     bananas
  6285.     carrots
  6286.     apples
  6287.     [ctrl-D]
  6288.     /home/larry/papers#
  6289.  
  6290. As you  can see,  the  result  of the  sort command  isn't  displayed,
  6291. instead it's saved  to the  file shopping-list.   Let's  look at  this
  6292. file.
  6293.  
  6294.     /home/larry/papers# cat shopping-list
  6295.     apples
  6296.     bananas
  6297.     carrots
  6298.     /home/larry/papers#
  6299. 3.8.   UNIX Plumbing                                               110
  6300. _______________________________________________________________________
  6301.  
  6302. Now we can  sort our  shopping list,  and  save it,  too!   But  let's
  6303. suppose that we were storing  our unsorted, original shopping  list in
  6304. the file items.  One way of sorting the information and saving it to a
  6305. file would be to give  sort the name of the  file to read, in  lieu of
  6306. standard input, and redirect standard output as we did above.  As so:
  6307.  
  6308.     /home/larry/papers# sort items > shopping-list
  6309.     /home/larry/papers# cat shopping-list
  6310.     apples
  6311.     bananas
  6312.     carrots
  6313.     /home/larry/papers#
  6314.  
  6315. However, there's another way of doing this.  Not only  can we redirect
  6316. standard output, but we can redirect standard input as well, using the
  6317. ``<'' symbol.
  6318.  
  6319.     /home/larry/papers# sort < items
  6320.     apples
  6321.     bananas
  6322.     carrots
  6323.     /home/larry/papers#
  6324.  
  6325. Technically, sort < items is equivalent to sort items,  but the former
  6326. allows us to demonstrate the  point:  sort <  items behaves as if  the
  6327. data in the file items was typed to standard input.  The shell handles
  6328. the redirection.  sort  wasn't given the name  of the file (items)  to
  6329. read; as far as sort is concerned, it was still  reading from standard
  6330. input as if you had typed the data from your keyboard.
  6331.   This introduces  the concept of  a filter.   A  filter is a  program
  6332. which reads data from  standard input, processes  it in some way,  and
  6333. sends the  processed data  to  standard output.    Using  redirection,
  6334. standard input and/or  standard output can  be referenced from  files.
  6335. sort is a simple  filter:  it  sorts the incoming  data and sends  the
  6336. result to  standard output.    cat is  even simpler:    it doesn't  do
  6337. anything with the incoming data, it simply outputs whatever  was given
  6338. to it.
  6339.  
  6340. 3.8.3 Using pipes
  6341.  
  6342. We've already demonstrated  how to  use sort  as a filter.    However,
  6343. these examples assumed that you had data in a file somewhere,  or were
  6344. willing to type the data to standard input yourself.  What if the data
  6345. you wanted to sort  came from the output  of another command, such  as
  6346. ls?   For example, using  the -r  option with sort  sorts the data  in
  6347. reverse-alphabetical order.  If you  wanted to list the files  in your
  6348. current directory in reverse order, one way to do it would be:
  6349.  
  6350.     /home/larry/papers# ls
  6351.     english-list
  6352. 3.8.   UNIX Plumbing                                               111
  6353. _______________________________________________________________________
  6354.  
  6355.     history-final
  6356.     masters-thesis
  6357.     notes
  6358.     /home/larry/papers# ls > file-list
  6359.     /home/larry/papers# sort -r file-list
  6360.     notes
  6361.     masters-thesis
  6362.     history-final
  6363.     english-list
  6364.     /home/larry/papers#
  6365.  
  6366. Here, we saved the  output of ls in  a file, and  then ran sort -r  on
  6367. that file.  But this is unwieldy and causes us to use a temporary file
  6368. to save the data from ls.
  6369.   The solution is  to use pipelining.   Pipelining is another  feature
  6370. of the shell which  allows you to  connect a string  of commands in  a
  6371. ``pipe'', where the stdout  of the first  command is sent directly  to
  6372. the stdin of the second command, and so on.  Here, we wish to send the
  6373. stdout of ls to the stdin of sort.  The ``_'' symbol is used to create
  6374. a pipe:
  6375.  
  6376.     /home/larry/papers# ls | sort -r
  6377.     notes
  6378.     masters-thesis
  6379.     history-final
  6380.     english-list
  6381.     /home/larry/papers#
  6382.  
  6383. This command is much shorter, and obviously easier to type.
  6384.   Another useful example---using the command
  6385.  
  6386.     /home/larry/papers# ls /usr/bin
  6387.  
  6388. is going to display a long list  a files, most of which will  fly past
  6389. the screen too quickly for you to read them.  Instead,  let's use more
  6390. to display the list of files in /usr/bin.
  6391.  
  6392.     /home/larry/papers# ls /usr/bin | more
  6393.  
  6394. Now you can page down the list of files at your own leisure.
  6395.   But the fun doesn't stop  here!  We can pipe more than  two commands
  6396. together.   The  command head  is a  filter which  displays the  first
  6397. lines from an input stream  (here, input from a  pipe).  If we  wanted
  6398. to display  the last  filename in  alphabetical order  in the  current
  6399. directory, we can use:
  6400.  
  6401.     /home/larry/papers# ls | sort -r | head -1
  6402.     notes
  6403.     /home/larry/papers#
  6404. 3.9.   File Permissions                                            112
  6405. _______________________________________________________________________
  6406.  
  6407. where head -1 simply displays the first line of input that it receives
  6408. (in this case, the stream of reverse-sorted data from ls).
  6409.  
  6410. 3.8.4 Non-destructive redirection
  6411.  
  6412. Using ``>'' to  redirect output to  a file is  destructive:  in  other
  6413. words, the command
  6414.  
  6415.     /home/larry/papers# ls > file-list
  6416.  
  6417. overwrites the  contents of  the file  file-list.   If,  instead,  you
  6418. redirect with the symbol  ``>>'', the output  will be appended to  the
  6419. named file, instead of overwriting it.
  6420.  
  6421.     /home/larry/papers# ls >> file-list
  6422.  
  6423. will append the output of the ls command to file-list.
  6424.   Just keep  in mind  that redirection  and using  pipes are  features
  6425. provided by the  shell---the shell  provides this  handy syntax  using
  6426. ``>'' and ``>>'' and ``_''.   It has  nothing to do with the  commands
  6427. themselves, but the shell.
  6428.  
  6429.  
  6430. 3.9 File Permissions
  6431.  
  6432. 3.9.1 Concepts of file permissions
  6433.  
  6434. Because there are multiple users on a UNIX system, in order to protect
  6435. individual user's files from tampering  by other users, UNIX  provides
  6436. a mechanism known as  file permissions.   This mechanism allows  files
  6437. and directories to be ``owned'' by a particular user.   As an example,
  6438. because Larry  created the  files in  his home  directory, Larry  owns
  6439. those files, and has access to them.
  6440.   UNIX also  allows files  to be  shared between users  and groups  of
  6441. users.  If  Larry so desired,  he could cut  off access to his  files,
  6442. such that no other user could  access them.  However, on  most systems
  6443. the default is to allow other users to read your files, but not modify
  6444. or delete them in any way.
  6445.   As  explained above,  every  file is  owned  by a  particular  user.
  6446. However, files  are  also owned  by a  particular  group, which  is  a
  6447. system-defined group of users.  Every user is placed into at least one
  6448. group when that user  is created.   However, the system  administrator
  6449. may also grant the user access to more than one group.
  6450.   Groups are  usually defined by  the type of  users which access  the
  6451. machine.   For example,  on  a university  UNIX system,  users may  be
  6452. placed into the groups  student, staff, faculty or  guest.  There  are
  6453. also a few  system-defined groups (such  as bin  and admin) which  are
  6454. used by the system itself to control access to resources---very rarely
  6455. do actual users belong to these system groups.
  6456.   Permissions  fall into  three  main  divisions:   read,  write,  and
  6457. 3.9.   File Permissions                                            113
  6458. _______________________________________________________________________
  6459.  
  6460. execute.  These permissions may be granted to three  classes of users:
  6461. the owner of the file, the group to which the file belongs, and to all
  6462. users, regardless of group.
  6463.   Read permission allows a  user to read the contents of the  file, or
  6464. in the case  of directories,  to list  the contents  of the  directory
  6465. (using ls).  Write permission  allows the user to write to  and modify
  6466. the file.  For directories, write permission allows the user to create
  6467. new files or  delete files within  that directory.   Finally,  execute
  6468. permission allows  the user  to run  the file  as a  program or  shell
  6469. script (if the file happens to be a program or shell script, that is).
  6470. For directories, having execute permission allows the user to  cd into
  6471. the directory in question.
  6472.  
  6473. 3.9.2 Interpreting file permissions
  6474.  
  6475. Let's look at an example to  demonstrate file permissions.   Using the
  6476. ls command with the -l option  will display a ``long'' listing  of the
  6477. file, including file permissions.
  6478.  
  6479.     /home/larry/foo# ls -l stuff
  6480.  
  6481.  
  6482.     -rw-r--r--   1 larry    users         505 Mar 13 19:05 stuff
  6483.  
  6484.  
  6485.     /home/larry/foo#
  6486.  
  6487.   The  first  field  printed  in  the  listing   represents  the  file
  6488. permissions.  The third  field is the owner  of the file (larry),  and
  6489. the fourth  field is  the group  to which  the  file belongs  (users).
  6490. Obviously, the last field is the  name of the file (stuff),  and we'll
  6491. cover the other fields later.
  6492.   This file is owned by larry, and belongs to the group  users.  Let's
  6493. look at the file permissions.  The string -rw-r--r-- lists,  in order,
  6494. the permissions granted  to the  file's owner, the  file's group,  and
  6495. everybody else.
  6496.   The first  character of  the permissions  string (``-'')  represents
  6497. the type  of  file.    A  ``-'' just  means  that  this is  a  regular
  6498. file (as opposed to  a directory or  device driver).   The next  three
  6499. letters (``rw-'')  represent the  permissions  granted to  the  file's
  6500. owner, larry.  The ``r'' stands for ``read'' and the  ``w'' stands for
  6501. ``write''.   Thus, larry  has read  and write permission  to the  file
  6502. stuff.
  6503.   As we mentioned,  besides read and  write permission, there is  also
  6504. ``execute'' permission---represented by an ``x''.   However, there  is
  6505. a ``-'' here  in place  of the ``x'',  so Larry  doesn't have  execute
  6506. permission on this file.  This is fine, the file stuff isn't a program
  6507. of any kind.   Of course,  because Larry owns the  file, he may  grant
  6508. himself execute permission for the file  if he so desires.   This will
  6509. be covered shortly.
  6510. 3.9.   File Permissions                                            114
  6511. _______________________________________________________________________
  6512.  
  6513.   The next  three characters, r--,  represent the group's  permissions
  6514. on the file.  The group which  owns this file is users.   Because only
  6515. an ``r'' appears here, any user  which belongs to the group  users may
  6516. read this file.
  6517.   The  last three  characters,  also  r--, represent  the  permissions
  6518. granted to every other user on the system (other than the owner of the
  6519. file and those in the group users).   Again, because only an  ``r'' is
  6520. present, other users may read the file, but not write to it or execute
  6521. it.
  6522.   Here are some other examples of group permissions.
  6523.  
  6524. -rwxr-xr-x The  owner of the  file may  read, write,  and execute  the
  6525.            file.  Users in the file's group,  and all other users, may
  6526.            read and execute the file.
  6527.  
  6528. -rw------- The  owner of the  file may read  and write the  file.   No
  6529.            other user can access the file.
  6530. -rwxrwxrwx All users may read, write, and execute the file.
  6531.  
  6532.  
  6533. 3.9.3 Dependencies
  6534.  
  6535. It is important to  note that the permissions  granted to a file  also
  6536. depend on  the permissions  of  the directory  in  which the  file  is
  6537. located.   For example,  even if a  file is set  to -rwxrwxrwx,  other
  6538. users cannot access the file unless they have read and  execute access
  6539. to the directory in which the file is located.  For  example, if Larry
  6540. wanted to restrict  access to all  of his files,  he could simply  set
  6541. the permissions on his home  directory /home/larry to -rwx------.   In
  6542. this way, no  other user has  access to his  directory, and all  files
  6543. and directories within  it.   Larry  doesn't need to  worry about  the
  6544. individual permissions on each of his files.
  6545.   In other  words, to  access a  file at  all, you  must have  execute
  6546. access to  all directories  along the  file's pathname,  and read  (or
  6547. execute) access to the file itself.
  6548.   Usually, users  on a  UNIX system  are very open  with their  files.
  6549. The usual set of permissions given to files is -rw-r--r--,  which will
  6550. allow other users to read the file, but not change it in any way.  The
  6551. usual set of  permissions given  to directories  is -rwxr-xr-x,  which
  6552. will allow  other users  to  look through  your directories,  but  not
  6553. create or delete files within them.
  6554.   However, many  users wish to  keep other users  out of their  files.
  6555. Setting the permissions  of a file  to -rw-------  will not allow  any
  6556. other user to access the file.  Likewise, setting the permissions of a
  6557. directory to -rwx------ will keep other users out of the  directory in
  6558. question.
  6559. 3.10.   Managing file links                                        115
  6560. _______________________________________________________________________
  6561.  
  6562. 3.9.4 Changing permissions
  6563.  
  6564. The command chmod is used to set the permissions on a file.   Only the
  6565. owner of a file may change the  permissions on that file.   The syntax
  6566. of chmod is:
  6567.  
  6568.     chmod {a,u,g,o}{+,-}{r,w,x} <filenames>
  6569.  
  6570.   Briefly,  you supply one  or more  of all,  user,  group, or  other.
  6571. Then you specify whether you are adding rights (+) or taking them away
  6572. (-).  Finally, you  specify one or more  of read, write, and  execute.
  6573. Some examples of legal commands are:
  6574.  
  6575. chmod a+r stuff
  6576.            Gives all users read access to the file.
  6577.  
  6578. chmod +r stuff
  6579.            Same as  above---if none of a, u,  g, or o is specified,  a
  6580.            is assumed.
  6581.  
  6582. chmod og-x stuff
  6583.            Remove execute permission from users other than the owner.
  6584.  
  6585. chmod u+rwx stuff
  6586.            Allow  the owner of  the file to  read, write, and  execute
  6587.            the file.
  6588. chmod o-rwx stuff
  6589.            Remove  read,  write,  and  execute permission  from  users
  6590.            other than the owner and users in the file's group.
  6591.  
  6592.  
  6593.  
  6594. 3.10 Managing file links
  6595.  
  6596. Links allow you  to give  a single  file multiple  names.   Files  are
  6597. actually identified  to the  system by  their inode  number, which  is
  6598. just the unique filesystem  identifier for the  file(3).  A  directory
  6599. is actually  a  listing  of  inode numbers  with  their  corresponding
  6600. filenames.  Each  filename in a  directory is a  link to a  particular
  6601. inode.
  6602.  
  6603. 3.10.1 Hard links
  6604.  
  6605. The ln command is  used to create  multiple links for  one file.   For
  6606. example, let's say that you have the  file foo in a directory.   Using
  6607. ls -i, we can look at the inode number for this file.
  6608.  
  6609. ----------------------------
  6610.  3. The command ls -i will display file inode numbers.
  6611. 3.10.   Managing file links                                        116
  6612. _______________________________________________________________________
  6613.  
  6614.     # ls -i foo
  6615.     22192 foo
  6616.     #
  6617.  
  6618. Here, the file foo has an inode number of 22192 in the filesystem.  We
  6619. can create another link to foo, named bar:
  6620.  
  6621.     # ln foo bar
  6622.  
  6623. With ls -i, we see that the two files have the same inode.
  6624.  
  6625.     # ls -i foo bar
  6626.     22192 bar   22192 foo
  6627.     #
  6628.  
  6629. Now, accessing either foo or  bar will access the  same file.  If  you
  6630. make changes to foo, those changes will  be made to bar as well.   For
  6631. all purposes, foo and bar are the same file.
  6632.   These links are known  as hard links because they directly  create a
  6633. link to an inode.  Note that you can only hard-link files  on the same
  6634. filesystem; symbolic links (see below) don't have this restriction.
  6635.   When you delete a  file with rm, you are actually only  deleting one
  6636. link to a file.  If you use the command
  6637.  
  6638.     # rm foo
  6639.  
  6640. then only the link named foo is deleted; bar will still exist.  A file
  6641. is only actually deleted  on the system  when it has  no links to  it.
  6642. Usually, files have only one link, so using the rm command deletes the
  6643. file.  However, if a file has multiple links to it, using rm will only
  6644. delete a single link; in order to delete the file, you must delete all
  6645. links to the file.
  6646.   The command ls -l will display the number of links  to a file (among
  6647. other information).
  6648.  
  6649.     # ls -l foo bar
  6650.     -rw-r--r--   2 root     root          12 Aug  5 16:51 bar
  6651.     -rw-r--r--   2 root     root          12 Aug  5 16:50 foo
  6652.     #
  6653.  
  6654. The second column in the listing, ``2'', specifies the number of links
  6655. to the file.
  6656.   As it  turns out,  a directory  is actually just  a file  containing
  6657. information about link-to-inode translations.   Also, every  directory
  6658. has at  least two  hard links  in it:   ``.''    (a  link pointing  to
  6659. itself), and ``..''  (a link  pointing to the parent directory).   The
  6660. root directory (/) ``..''  link just points back to /.
  6661. 3.11.   Job Control                                                117
  6662. _______________________________________________________________________
  6663.  
  6664. 3.10.2 Symbolic links
  6665.  
  6666. Symbolic links are another type of link, which are  somewhat different
  6667. than hard links.   A symbolic link allows  you to give a file  another
  6668. name, but it doesn't link the file by inode.
  6669.   The command  ln -s  will create  a symbolic  link to  a file.    For
  6670. example, if we use the command
  6671.  
  6672.     # ln -s foo bar
  6673.  
  6674. we will create the  symbolic link bar  pointing to the  file foo.   If
  6675. we use ls -i,  we will see that  the two files have different  inodes,
  6676. indeed.
  6677.  
  6678.     # ls -i foo bar
  6679.     22195 bar   22192 foo
  6680.     #
  6681.  
  6682. However, using ls -l, we see  that the file bar is a  symlink pointing
  6683. to foo.
  6684.  
  6685.     # ls -l foo bar
  6686.     lrwxrwxrwx   1 root     root           3 Aug  5 16:51  bar -> foo
  6687.     -rw-r--r--   1 root     root          12 Aug  5 16:50 foo
  6688.     #
  6689.  
  6690.   The permission  bits on a  symbolic link are  not used (they  always
  6691. appear as rwxrwxrwx).  Instead,  the permissions on the  symbolic link
  6692. are determined by the permissions  on the target of the  symbolic link
  6693. (in our example, the file foo).
  6694.   Functionally, hard links  and symbolic links are similar,  but there
  6695. are some differences.  For  one thing, you can create a  symbolic link
  6696. to a file which doesn't  exist; the same  is not true for hard  links.
  6697. Symbolic links are processed by the kernel differently than hard links
  6698. are, which is just a  technical difference but sometimes  an important
  6699. one.  Symbolic links are helpful because they identify  what file they
  6700. point to; with  hard links, there  is no easy  way to determine  which
  6701. files are linked to the same inode.
  6702.   Links are used in many  places on the Linux system.   Symbolic links
  6703. are especially important to  the shared library images  in /lib.   See
  6704. Section 4.7.2 for more information.
  6705.  
  6706.  
  6707. 3.11 Job Control
  6708.  
  6709. 3.11.1 Jobs and processes
  6710.  
  6711. Job control  is a  feature  provided by  many  shells (Bash  and  Tcsh
  6712. included) which allows  you to control  multiple running commands,  or
  6713. 3.11.   Job Control                                                118
  6714. _______________________________________________________________________
  6715.  
  6716. jobs, at once.   Before  we can delve  much further,  we need to  talk
  6717. about processes.
  6718.   Every  time  you run  a  program,  you  start  what is  known  as  a
  6719. process---which is  just a  fancy name  for a  running program.    The
  6720. command ps displays a list of currently running processes.   Here's an
  6721. example:
  6722.  
  6723.     /home/larry# ps
  6724.  
  6725.  
  6726.       PID TT STAT  TIME COMMAND
  6727.        24  3 S     0:03 (bash)
  6728.       161  3 R     0:00 ps
  6729.  
  6730.  
  6731.     /home/larry#
  6732.  
  6733. The PID  listed  in the  first  column is  the  process ID,  a  unique
  6734. number given to  every running  process.   The  last column,  COMMAND,
  6735. is the name  of the  running command.    Here, we're  only looking  at
  6736. the processes which  Larry is currently  running(4).   These are  bash
  6737. (Larry's shell), and the ps command itself.   As you can see,  bash is
  6738. running concurrently with the ps command.  bash executed ps when Larry
  6739. typed the command.    After ps  is finished running  (after the  table
  6740. of processes is displayed), control  is returned to the  bash process,
  6741. which displays the prompt, ready for another command.
  6742.   A running  process  is known  as a  job to  the shell.    The  terms
  6743. process and job are  interchangeable.   However, a process is  usually
  6744. referred to as a ``job'' when used in conjunction with job control---a
  6745. feature of  the  shell which  allows  you  to switch  between  several
  6746. independent jobs.
  6747.   In most cases users  are only running a single job at  a time---that
  6748. being whatever command they last typed  to the shell.  However,  using
  6749. job control, you can run several jobs at once,  switching between them
  6750. as needed.  How might this be useful?  Let's say that you're editing a
  6751. text file and need to suddenly interrupt your editing and do something
  6752. else.  With job control,  you can temporarily suspend the editor,  and
  6753. back at the shell prompt start to work on something else.  When you're
  6754. done, you can start the editor back up, and be back where you started,
  6755. as if you never left the editor.  This is just one example.  There are
  6756. many practical uses for job control.
  6757.  
  6758. 3.11.2 Foreground and background
  6759.  
  6760. Jobs can either be in the foreground or in the background.   There can
  6761. only be one job  in the foreground  at any one  time.  The  foreground
  6762.  
  6763. ----------------------------
  6764.  4.  There  are  many  other  processes  running  on  the   system  as
  6765. well---``ps -aux'' lists them all.
  6766. 3.11.   Job Control                                                119
  6767. _______________________________________________________________________
  6768.  
  6769. job is the job  which you interact  with---it receives input from  the
  6770. keyboard and sends  output to your  screen.   (Unless, of course,  you
  6771. have redirected input  or output, as  described in Section  3.8).   On
  6772. the other  hand, jobs  in the  background  do not  receive input  from
  6773. the terminal---in general,  they run  along quietly  without need  for
  6774. interaction.
  6775.   Some  jobs take  a  long  time  to finish,  and  don't  do  anything
  6776. interesting while they are  running.   Compiling programs is one  such
  6777. job, as is compressing a large file.  There's no reason why you should
  6778. sit around being bored while these jobs complete their tasks;  you can
  6779. just run them in the  background.  While  the jobs are running in  the
  6780. background, you are free to run other programs.
  6781.   Jobs may  also be  suspended.   A  suspended job  is a  job that  is
  6782. not currently running, but is temporarily stopped.   After you suspend
  6783. a job, you  can tell  the job to  continue, in  the foreground or  the
  6784. background as needed.   Resuming a suspended  job will not change  the
  6785. state of the job in  any way---the job will  continue to run where  it
  6786. left off.
  6787.   Note that  suspending  a job  is not  equal to  interrupting a  job.
  6788. When you interrupt a running  process (by hitting your interrupt  key,
  6789. which is usually [ctrl-C])(5), it kills  the process, for good.   Once
  6790. the job is  killed, there's  no hope of  resuming it;  you'll have  to
  6791. re-run the command.  Also note that some programs  trap the interrupt,
  6792. so that hitting [ctrl-C] won't immediately  kill the job.  This  is to
  6793. allow the program to perform  any necessary cleanup operations  before
  6794. exiting.  In fact, some  programs simply don't allow you to  kill them
  6795. with an interrupt at all.
  6796.  
  6797. 3.11.3 Backgrounding and killing jobs
  6798.  
  6799. Let's begin with a  simple example.   The command  yes is a  seemingly
  6800. useless command  which sends  an  endless stream  of y's  to  standard
  6801. output.  (This  is actually useful.   If you  piped the output of  yes
  6802. to another command which asked a  series of yes and no questions,  the
  6803. stream of y's would confirm all of the questions.)
  6804.   Try it out.
  6805.  
  6806.     /home/larry# yes
  6807.     y
  6808.     y
  6809.     y
  6810.     y
  6811.     y
  6812.  
  6813.  
  6814. ----------------------------
  6815.  5. The interrupt key can be set using the stty command.   The default
  6816. on most systems is [ctrl-C], but we can't guarantee the  same for your
  6817. system.
  6818. 3.11.   Job Control                                                120
  6819. _______________________________________________________________________
  6820.  
  6821. The y's will  continue ad  infinitum.   You  can kill  the process  by
  6822. hitting your  interrupt key,  which is  usually [ctrl-C].  So that  we
  6823. don't have to put up with  the annoying stream of y's,  let's redirect
  6824. the standard  output  of yes  to  /dev/null.    As you  may  remember,
  6825. /dev/null acts as a ``black hole'' for data.  Any data sent to it will
  6826. disappear.  This is a  very effective method of quieting  an otherwise
  6827. verbose program.
  6828.  
  6829.     /home/larry# yes > /dev/null
  6830.  
  6831. Ah, much better.   Nothing  is printed, but  the shell prompt  doesn't
  6832. come back.  This is because yes is still running, and is sending those
  6833. inane y's to /dev/null.   Again,  to kill the  job, hit the  interrupt
  6834. key.
  6835.   Let's suppose  that we wanted  the yes command  to continue to  run,
  6836. but wanted to get our shell prompt  back to work on other things.   We
  6837. can put yes  into the  background,  which will  allow it  to run,  but
  6838. without need for interaction.
  6839.   One way  to put a process  in the background  is to append an  ``&''
  6840. character to the end of the command.
  6841.  
  6842.     /home/larry# yes > /dev/null &
  6843.     [1] 164
  6844.     /home/larry#
  6845.  
  6846. As you can  see, we  have our shell  prompt back.   But  what is  this
  6847. ``[1] 164''?  And is the yes command really running?
  6848.   The ``[1]''  represents the  job number for  the yes  process.   The
  6849. shell assigns a job number to every  running job.  Because yes  is the
  6850. one and only  job that  we're currently  running, it  is assigned  job
  6851. number 1.  The ``164'' is the process ID, or PID, number  given by the
  6852. system to the job.  Either number may be used to refer to  the job, as
  6853. we'll see later.
  6854.   You  now   have  the   yes  process  running   in  the   background,
  6855. continuously sending a stream of  y's to /dev/null.   To check on  the
  6856. status of this process, use the shell internal command jobs.
  6857.  
  6858.     /home/larry# jobs
  6859.     [1]+  Running                 yes >/dev/null  &
  6860.     /home/larry#
  6861.  
  6862. Sure enough,  there it  is.   You  could also  use the  ps command  as
  6863. demonstrated above to check on the status of the job.
  6864.   To terminate  the job,  use the command  kill.   This command  takes
  6865. either a job number or a process  ID number as an argument.   This was
  6866. job number 1, so using the command
  6867.  
  6868.     /home/larry# kill %1
  6869.  
  6870. will kill the job.  When identifying the job with the  job number, you
  6871. 3.11.   Job Control                                                121
  6872. _______________________________________________________________________
  6873.  
  6874. must prefix the number with a percent (``%'') character.
  6875.   Now that  we've killed the job,  we can use  jobs again to check  on
  6876. it:
  6877.  
  6878.     /home/larry# jobs
  6879.  
  6880.  
  6881.     [1]+  Terminated              yes >/dev/null
  6882.  
  6883.  
  6884.     /home/larry#
  6885.  
  6886. The job is in fact dead, and if we use the jobs  command again nothing
  6887. should be printed.
  6888.   You can also kill  the job using the process ID (PID)  number, which
  6889. is printed along  with the  job ID when  you start  the job.   In  our
  6890. example, the process ID is 164, so the command
  6891.  
  6892.     /home/larry# kill 164
  6893.  
  6894. is equivalent to
  6895.  
  6896.     /home/larry# kill %1
  6897.  
  6898. You don't need to use the ``%'' when referring to a job by its process
  6899. ID.
  6900.  
  6901. 3.11.4 Stopping and restarting jobs
  6902.  
  6903. There is another way to put a job into the background.   You can start
  6904. the job normally (in the foreground),  stop the job, and  then restart
  6905. it in the background.
  6906.   First, start  the yes  process in  the foreground,  as you  normally
  6907. would:
  6908.  
  6909.     /home/larry# yes > /dev/null
  6910.  
  6911. Again, because yes  is running  in the foreground,  you shouldn't  get
  6912. your shell prompt back.
  6913.   Now, instead  of interrupting the  job with [ctrl-C], we'll  suspend
  6914. the job.  Suspending a job doesn't kill it:  it only temporarily stops
  6915. the job until you restart  it.  To do  this, you hit the  suspend key,
  6916. which is usually [ctrl-Z].
  6917.  
  6918.     /home/larry# yes > /dev/null
  6919.     [ctrl-Z]
  6920.     [1]+  Stopped                 yes >/dev/null
  6921.     /home/larry#
  6922.  
  6923. While the job is suspended, it's simply  not running.  No CPU  time is
  6924. 3.11.   Job Control                                                122
  6925. _______________________________________________________________________
  6926.  
  6927. used for the job.  However, you can restart the job,  which will cause
  6928. the job to run again as if nothing ever happened.  It will continue to
  6929. run where it left off.
  6930.   To  restart the  job in  the  foreground, use  the  command fg  (for
  6931. ``foreground'').
  6932.  
  6933.     /home/larry# fg
  6934.     yes >/dev/null
  6935.  
  6936. The shell prints  the name  of the  command again so  you're aware  of
  6937. which job you  just put  into the  foreground.   Stop  the job  again,
  6938. with [ctrl-Z]. This time, use the  command bg to put the job  into the
  6939. background.  This will cause the command to run just as if you started
  6940. the command with ``&'' as in the last section.
  6941.  
  6942.     /home/larry# bg
  6943.     [1]+ yes >/dev/null &
  6944.     /home/larry#
  6945.  
  6946. And we have our prompt  back.  jobs  should report that yes is  indeed
  6947. running, and we can kill the job with kill as we did before.
  6948.   How can we stop the  job again?  Using [ctrl-Z] won't  work, because
  6949. the job is in  the background.   The answer is to  put the job in  the
  6950. foreground, with fg, and then stop it.  As it turns out you can use fg
  6951. on either stopped jobs or jobs in the background.
  6952.   There is  a big  difference between a  job in  the background and  a
  6953. job which is stopped.   A stopped job is not running---it's  not using
  6954. any CPU time,  and it's  not doing  any work (the  job still  occupies
  6955. system memory, although it may be swapped out to disk).  A  job in the
  6956. background is running, and  using memory, as  well as completing  some
  6957. task while you do other  work.  However,  a job in the background  may
  6958. try to display  text on  to your terminal,  which can  be annoying  if
  6959. you're trying to work on something else.  For example, if you used the
  6960. command
  6961.  
  6962.     /home/larry# yes &
  6963.  
  6964. without redirecting  stdout to  /dev/null, a  stream of  y's would  be
  6965. printed to your screen, without any way of interrupting  it (you can't
  6966. use [ctrl-C] to interrupt jobs in  the background).  In order  to stop
  6967. the endless y's, you'd have to use the fg command, to bring the job to
  6968. the foreground, and then use [ctrl-C] to kill it.
  6969.   Another  note.    The fg  and  bg  commands normally  foreground  or
  6970. background the job which was  last stopped (indicated by a  ``+'' next
  6971. to the job number when you use the command jobs).  If  you are running
  6972. multiple jobs at once, you can foreground or background a specific job
  6973. by giving the job ID as an argument to fg or bg, as in
  6974.  
  6975.     /home/larry# fg %2
  6976. 3.12.   Using the vi Editor                                        123
  6977. _______________________________________________________________________
  6978.  
  6979. (to foreground job number 2), or
  6980.  
  6981.     /home/larry# bg %3
  6982.  
  6983. (to background job number 3).   You can't use process ID  numbers with
  6984. fg or bg.
  6985.   Furthermore, using the job number alone, as in
  6986.  
  6987.     /home/larry# %2
  6988.  
  6989. is equivalent to
  6990.  
  6991.     /home/larry# fg %2
  6992.  
  6993.   Just remember  that using  job control  is a feature  of the  shell.
  6994. The commands fg, bg and jobs are  internal to the shell.  If  for some
  6995. reason you  use a  shell which  does not  support job  control,  don't
  6996. expect to find these commands available.
  6997.   In addition,  there are  some aspects  of job  control which  differ
  6998. between Bash and Tcsh.  In fact, some shells don't provide job control
  6999. at all---however, most shells available for Linux support job control.
  7000.  
  7001.  
  7002. 3.12 Using the vi Editor
  7003.  
  7004. A text editor  is simply a  program used to  edit files which  contain
  7005. text, such as  a letter, C  program, or  a system configuration  file.
  7006. While there are many such editors available for Linux, the only editor
  7007. which you  are guaranteed  to find  on any  UNIX system  is vi---  the
  7008. ``visual editor''.   vi is not  the easiest editor to  use, nor is  it
  7009. very self-explanatory.  However, because  it is so common in  the UNIX
  7010. world, and at times  you may be required to  use it, it deserves  some
  7011. documentation here.
  7012.   Your choice of an editor is mostly a question  of personal taste and
  7013. style.  Many users  prefer the baroque, self-explanatory  and powerful
  7014. Emacs---an editor with more features than any other single  program in
  7015. the UNIX world.   For example, Emacs  has its own built-in dialect  of
  7016. the LISP programming language, and  has many extensions (one  of which
  7017. is an ``Eliza''-like AI program).   However, because Emacs and  all of
  7018. its support files  are relatively large,  you may  not have access  to
  7019. it on many systems.   vi,  on the other hand,  is small and  powerful,
  7020. but more difficult to  use.   However, once you  know your way  around
  7021. vi, it's actually very  easy.  It's  just the learning curve which  is
  7022. sometimes difficult to cross.
  7023.   This section  is a  coherent introduction to  vi---we won't  discuss
  7024. all of  its features,  just  the ones  you  need to  know to  get  you
  7025. started.  You can  refer to the man  page for vi if you're  interested
  7026. in learning about more of  this editor's features.   Or, you can  read
  7027. the book Learning  the vi Editor  from O'Reilly and  Associates.   See
  7028. Appendix A for information.
  7029. 3.12.   Using the vi Editor                                        124
  7030. _______________________________________________________________________
  7031.  
  7032. 3.12.1 Concepts
  7033.  
  7034. While using vi,  at any  one time  you are  in one of  three modes  of
  7035. operation.  These  modes are known as  command mode, insert mode,  and
  7036. last line mode.
  7037.   When you start  up vi, you  are in command mode.   This mode  allows
  7038. you to use certain commands to edit files or to change to other modes.
  7039. For example, typing ``x'' while in command mode deletes  the character
  7040. underneath the cursor.  The arrow keys move the cursor around the file
  7041. which you're editing.   Generally, the  commands used in command  mode
  7042. are one or two characters long.
  7043.   You actually  insert or edit  text within insert mode.   When  using
  7044. vi, you'll probably  spend most of your  time within this  mode.   You
  7045. start insert mode by  using a command  such as ``i'' (for  ``insert'')
  7046. from command mode.  While in insert mode, you are  inserting text into
  7047. the document from your  current cursor location.   To end insert  mode
  7048. and return to command mode, press [esc].
  7049.   Last line  mode  is a  special mode  used to  give certain  extended
  7050. commands to vi.  While typing these commands, they appear  on the last
  7051. line of the screen (hence the name).  For example, when you type ``:''
  7052. from command mode, you jump into last line mode, and  can use commands
  7053. such as ``wq'' (to write  the file and quit vi),  or ``q!''   (to quit
  7054. vi without saving changes).   Last line mode is generally used  for vi
  7055. commands which are longer than one character.  In last  line mode, you
  7056. enter a single-line command and press [enter] to execute it.
  7057.  
  7058. 3.12.2 Starting vi
  7059.  
  7060. The best way to  understand these concepts is  to actually fire up  vi
  7061. and edit a file.   In the example ``screens'' below, we're  only going
  7062. to show a few lines of text, as if the screen was only  six lines high
  7063. (instead of twenty-four).
  7064.   The syntax for vi is
  7065.  
  7066.     vi <filename>
  7067.  
  7068. where <filename> is the name of the file that you wish to edit.
  7069.   Start up vi by typing
  7070.  
  7071.     /home/larry# vi test
  7072.  
  7073. which will edit the file test.  You should see something like
  7074.  
  7075.  ____________________________________________________________________
  7076.  |~_                                                                 |
  7077.  |~                                                                  |
  7078.  |~                                                                  |
  7079.  |~                                                                  |
  7080.  |~                                                                  |
  7081.  |"test"_[New_file]__________________________________________________|
  7082.  
  7083. 3.12.   Using the vi Editor                                        125
  7084. _______________________________________________________________________
  7085.  
  7086.   The column  of ``~'' characters  indicates that you  are the end  of
  7087. the file.
  7088.  
  7089. 3.12.3 Inserting text
  7090.  
  7091. You are now in command  mode; in order  to insert text into the  file,
  7092. press [i] (which will place you into insert mode), and begin typing.
  7093.  
  7094.   ____________________________________________________________________
  7095.  |Now is the time for all good men to come to the aid of the party._ |
  7096.  |~                                                                  |
  7097.  |~                                                                  |
  7098.  |~                                                                  |
  7099.  |~                                                                  |
  7100.  |~__________________________________________________________________|
  7101.  
  7102.   While  inserting text,  you  may  type as  many  lines as  you  wish
  7103. (pressing [return]  after  each,  of  course),  and  you  may  correct
  7104. mistakes using the backspace key.
  7105.   To end insert mode, and return to command mode, press [esc].
  7106.   While in  command mode, you  can use the arrow  keys to move  around
  7107. the file.  Here, because we only have one line of text,  trying to use
  7108. the up- or down-arrow keys will probably cause vi to beep at you.
  7109.   There  are several  ways to  insert  text, other  than  using the  i
  7110. command.  For example, the a command inserts text  beginning after the
  7111. current cursor position,  instead of on  the current cursor  position.
  7112. For example, use  the left arrow  key to move  the cursor between  the
  7113. words ``good'' and ``men''.
  7114.  
  7115.   ____________________________________________________________________
  7116.  |Now is the time for all good_men to come to the aid of the party.  |
  7117.  |~                                                                  |
  7118.  |~                                                                  |
  7119.  |~                                                                  |
  7120.  |~                                                                  |
  7121.  |~__________________________________________________________________|
  7122.  
  7123. Press [a], to start  insert mode, type ``wo'',  and then hit [esc]  to
  7124. return to command mode.
  7125.  
  7126.   ____________________________________________________________________
  7127.   |Now is the time for all good women to come to the aid of the party.|
  7128.   |~                                                                  |
  7129.   |~                                                                  |
  7130.   |~                                                                  |
  7131.   |~                                                                  |
  7132.   |~__________________________________________________________________|
  7133.  
  7134.   To begin inserting text  at the line below the current one,  use the
  7135. o command.  For example, press [o] and type another line or two:
  7136. 3.12.   Using the vi Editor                                        126
  7137. _______________________________________________________________________
  7138.   
  7139.   ____________________________________________________________________
  7140.  |Now is the time for all good women to come to the aid of the party.|
  7141.  |Afterwards, we'll go out for pizza and beer._                      |
  7142.  |~                                                                  |
  7143.  |~                                                                  |
  7144.  |~                                                                  |
  7145.  |~__________________________________________________________________|
  7146.  
  7147.   Just  remember that  at  any  time  you're either  in  command  mode
  7148. (where commands such  as i,  a, or  o are  valid), or  in insert  mode
  7149. (where you're inserting text, followed  by [esc] to return  to command
  7150. mode), or last line mode (where you're entering extended  commands, as
  7151. discussed below).
  7152.  
  7153. 3.12.4 Deleting text
  7154.  
  7155. From command  mode, the  x  command deletes  the  character under  the
  7156. cursor.  If you press [x] five times, you'll end up with:
  7157.  
  7158.   ____________________________________________________________________
  7159.  |Now is the time for all good women to come to the aid of the party.|
  7160.  |Afterwards, we'll go out for pizza and _                           |
  7161.  |~                                                                  |
  7162.  |~                                                                  |
  7163.  |~                                                                  |
  7164.  |~__________________________________________________________________|
  7165.  
  7166. Now press [a], insert some text, followed by [esc]:
  7167.   ____________________________________________________________________
  7168.  |Now is the time for all good women to come to the aid of the party.|
  7169.  |Afterwards, we'll go out for pizza and Diet Coke._                 |
  7170.  |~                                                                  |
  7171.  |~                                                                  |
  7172.  |~                                                                  |
  7173.  |~__________________________________________________________________|
  7174.  
  7175.   You can  delete entire lines  using the command  dd (that is,  press
  7176. [d] twice in a row).   If your cursor is  on the second line,  and you
  7177. type dd,
  7178.   ____________________________________________________________________
  7179.  |Now is the time for all good women to come to the aid of the party.|
  7180.  |~                                                                  |
  7181.  |~                                                                  |
  7182.  |~                                                                  |
  7183.  |~                                                                  |
  7184.  |~__________________________________________________________________|
  7185. 3.12.   Using the vi Editor                                        127
  7186. _______________________________________________________________________
  7187.  
  7188.   To delete  the word  which the  cursor is  on, use  the dw  command.
  7189. Place the cursor on the word ``good'', and type dw.
  7190.   ____________________________________________________________________
  7191.  |Now is the time for all women to come to the aid of the party.     |
  7192.  |~                                                                  |
  7193.  |~                                                                  |
  7194.  |~                                                                  |
  7195.  |~                                                                  |
  7196.  |~__________________________________________________________________|
  7197.  
  7198. 3.12.5 Changing text
  7199.  
  7200. You can replace  sections of  text using  the R  command.   Place  the
  7201. cursor on the first letter in ``party'', press [R], and  type the word
  7202. ``hungry''.
  7203.  
  7204.   ____________________________________________________________________
  7205.  |Now is the time for all women to come to the aid of the hungry._   |
  7206.  |~                                                                  |
  7207.  |~                                                                  |
  7208.  |~                                                                  |
  7209.  |~                                                                  |
  7210.  |~__________________________________________________________________|
  7211.  
  7212. Using R  to edit  text  is much  like  the i  and  a commands,  but  R
  7213. overwrites text, instead of inserting it.
  7214.   The r command replaces  the single character under the cursor.   For
  7215. example, move the  cursor to the  beginning of  the word ``Now'',  and
  7216. type r followed by C, you'll have:
  7217.  
  7218.   ____________________________________________________________________
  7219.  |Cow is the time for all women to come to the aid of the hungry._   |
  7220.  |~                                                                  |
  7221.  |~                                                                  |
  7222.  |~                                                                  |
  7223.  |~                                                                  |
  7224.  |~__________________________________________________________________|
  7225.  
  7226.   The ``~'' command  changes the case of  the letter under the  cursor
  7227. from upper- to lower-case, and vise  versa, For example, if  you place
  7228. the cursor on the ``o'' in  ``Cow'', above, and repeatedly  press [~],
  7229. you'll end up with:
  7230. 3.12.   Using the vi Editor                                        128
  7231. _______________________________________________________________________
  7232.  
  7233.   ____________________________________________________________________
  7234.  |COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.    |
  7235.  |~                                                                  |
  7236.  |~                                                                  |
  7237.  |~                                                                  |
  7238.  |~                                                                  |
  7239.  |~__________________________________________________________________|
  7240.  
  7241. 3.12.6 Moving commands
  7242.  
  7243. You already  know  how  to use  the  arrow  keys to  move  around  the
  7244. document.   In addition,  you  can use the  h,  j, k,  and l  commands
  7245. to move the  cursor left,  down, up,  and right,  respectively.   This
  7246. comes in handy when (for  some reason) your arrow keys  aren't working
  7247. correctly.
  7248.   The w command  moves the cursor to  the beginning of the next  word;
  7249. the b moves it to the beginning of the previous word.
  7250.   The 0 (that's a  zero) command moves the cursor to the  beginning of
  7251. the current line, and the $ command moves it to the end of the line.
  7252.   When editing large files, you'll want to move  forwards or backwards
  7253. through the file a screenful at  a time.  Pressing [ctrl-F]  moves the
  7254. cursor one screenful forward, and [ctrl-B] moves it a screenful back.
  7255.   In order  to move the  cursor to the  end of the  file, type G.  You
  7256. can also move to  an arbitrary line;  for example, typing the  command
  7257. 10G would move the  cursor to line  10 in the  file.   To move to  the
  7258. beginning of the file, use 1G.
  7259.   You  can  couple  moving  commands  with  other  commands,  such  as
  7260. deletion.  For example, the command d$ will delete everything from the
  7261. cursor to the  end of  the line;  dG will delete  everything from  the
  7262. cursor to the end of the file, and so on.
  7263.  
  7264. 3.12.7 Saving files and quitting vi
  7265.  
  7266. To quit vi without  making changes to the  file, use the command  :q!.
  7267. When you type the ``:'', the cursor will move to the last  line on the
  7268. screen; you'll be in last line mode.
  7269.  
  7270.   ____________________________________________________________________
  7271.  |COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.    |
  7272.  |~                                                                  |
  7273.  |~                                                                  |
  7274.  |~                                                                  |
  7275.  |~                                                                  |
  7276.  |~                                                                  |
  7277.  |:__________________________________________________________________|
  7278.  
  7279. In last line mode,  certain extended commands are  available.  One  of
  7280. them is q!, which quits vi without saving.  The command  :wq saves the
  7281. file and then exits vi.   The command  ZZ (from command mode,  without
  7282. 3.12.   Using the vi Editor                                        129
  7283. _______________________________________________________________________
  7284.  
  7285. the ``:'')   is  equivalent to  :wq.   Remember  that  you must  press
  7286. [enter] after a command entered in last line mode.
  7287.   To save the file without quitting vi, just use :w.
  7288.  
  7289. 3.12.8 Editing another file
  7290.  
  7291. To edit  another file,  use the  :e command.    For  example, to  stop
  7292. editing test, and edit the file foo instead, use the command
  7293.  
  7294.   ____________________________________________________________________
  7295.  |COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.    |
  7296.  |~                                                                  |
  7297.  |~                                                                  |
  7298.  |~                                                                  |
  7299.  |~                                                                  |
  7300.  |~                                                                  |
  7301.  |:e foo_____________________________________________________________|
  7302.  
  7303. If you use  :e without  saving the file  first, you'll  get the  error
  7304. message
  7305.  ____________________________________________________________________
  7306.  |No_write_since_last_change_(":edit!"_overrides)____________________|
  7307.  
  7308. which simply means  that vi doesn't  want to  edit another file  until
  7309. you save the first  one.  At  this point, you can  use :w to save  the
  7310. original file, and then use :e, or you can use the command
  7311.   ____________________________________________________________________
  7312.  |COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.    |
  7313.  |~                                                                  |
  7314.  |~                                                                  |
  7315.  |~                                                                  |
  7316.  |~                                                                  |
  7317.  |~                                                                  |
  7318.  |:e! foo_____________________________________________________________|
  7319.  
  7320. The ``!''    tells vi  that you  really mean  it---edit  the new  file
  7321. without saving changes to the first.
  7322.  
  7323.  
  7324. 3.12.9 Including other files
  7325.  
  7326. If you use  the :r command,  you can include  the contents of  another
  7327. file in the current file.  For example, the command
  7328.  
  7329.     :r foo.txt
  7330.  
  7331. would insert  the contents  of the  file foo.txt  in the  text at  the
  7332. current cursor location.
  7333. 3.13.   Customizing your Environment                               130
  7334. _______________________________________________________________________
  7335.  
  7336. 3.12.10 Running shell commands
  7337.  
  7338. You can also  run shell commands  from within vi.   The  :r!   command
  7339. works like :r, but instead of reading a file, it inserts the output of
  7340. the given command into the buffer at the current cursor location.  For
  7341. example, if you use the command
  7342.  
  7343.     :r!  ls -F
  7344.  
  7345. you'll end up with
  7346.  
  7347.   ____________________________________________________________________
  7348.  |COW IS THE TIME FOR ALL WOMEN TO COME TO THE AID OF THE HUNGRY.    |
  7349.  |letters/                                                           |
  7350.  |misc/                                                              |
  7351.  |papers/_                                                           |
  7352.  |~                                                                  |
  7353.  |~__________________________________________________________________|
  7354.  
  7355.   You can  also ``shell out''  of vi,  in other words,  run a  command
  7356. from within  vi, and  return to  the editor  when  you're done.    For
  7357. example, if you use the command
  7358.  
  7359.     :!  ls -F
  7360.  
  7361. the ls -F command will be  executed, and the results displayed  on the
  7362. screen, but not inserted into the  file which you're editing.   If you
  7363. use the command
  7364.  
  7365.     :shell
  7366.  
  7367. vi will start an  instance of the  shell, allowing you to  temporarily
  7368. put vi ``on hold'' while you  execute other commands.  Just  logout of
  7369. the shell (using the exit command) to return to vi.
  7370.  
  7371. 3.12.11 Getting help
  7372.  
  7373. vi doesn't provide  much in  the way  of interactive  help (most  UNIX
  7374. programs don't), but you can always read the man page for vi.  vi is a
  7375. visual front-end to the ex editor; it is ex which handles  many of the
  7376. last-line mode commands in  vi.   So, in addition  to reading the  man
  7377. page for vi, see ex as well.
  7378.  
  7379.  
  7380. 3.13 Customizing your Environment
  7381.  
  7382. The shell provides many mechanisms to customize your work environment.
  7383. As  we've  mentioned  before,  the  shell  is  more   than  a  command
  7384. interpreter---it is  also  a powerful  programming  language.    While
  7385. writing shell scripts is an extensive subject, we'd like  to introduce
  7386. 3.13.   Customizing your Environment                               131
  7387. _______________________________________________________________________
  7388.  
  7389. you to some  of the ways  that you can  simplify your  work on a  UNIX
  7390. system by using these advanced features of the shell.
  7391.   As  we  have  mentioned  before,   different  shells  use  different
  7392. syntaxes when  executing shell  scripts.   For  example,  Tcsh uses  a
  7393. C-like syntax, while  Bourne shells use  another type of  syntax.   In
  7394. this section, we won't be running into many of the differences between
  7395. the two, but we will assume that shell scripts are  executed using the
  7396. Bourne shell syntax.
  7397.  
  7398. 3.13.1 Shell scripts
  7399.  
  7400. Let's say that you use a  series of commands often, and would  like to
  7401. shorten the amount of required typing by grouping all of them together
  7402. into a single ``command''.  For example, the commands
  7403.  
  7404.     /home/larry# cat chapter1 chapter2 chapter3 > book
  7405.     /home/larry# wc -l book
  7406.     /home/larry# lp book
  7407.  
  7408. would concatenate the files chapter1, chapter2, and chapter3 and place
  7409. the result in the file book.  Then, a count of the number  of lines in
  7410. book would be displayed, and finally book would be printed with the lp
  7411. command.
  7412.   Instead of typing all  of these commands, you could group  them into
  7413. a shell script.  We described shell scripts briefly in Section 3.13.1.
  7414. The shell script used to run all of these commands would look like
  7415.  
  7416.     #!/bin/sh
  7417.     # A shell script to create and print the book
  7418.  
  7419.     cat chapter1 chapter2 chapter3 > book
  7420.     wc -l book
  7421.     lp book
  7422.  
  7423. If this script was  saved in the file  makebook, you could simply  use
  7424. the command
  7425.  
  7426.     /home/larry# makebook
  7427.  
  7428. to run all  of the commands  in the script.    Shell scripts are  just
  7429. plain text files; you can create them with an editor such  as emacs or
  7430. vi (6).
  7431.   Let's look  at this shell  script.   The first line,  ``#!/bin/sh'',
  7432. identifies the file  as a  shell script,  and tells the  shell how  to
  7433. execute the script.    It instructs the  shell to  pass the script  to
  7434. /bin/sh for  execution, where  /bin/sh is  the  shell program  itself.
  7435. Why is  this  important?     On  most  UNIX  systems,   /bin/sh  is  a
  7436.  
  7437. ----------------------------
  7438.  6. vi is covered in Section 3.12.
  7439.    3.13.   Customizing your Environment                               132
  7440.    _______________________________________________________________________
  7441.  
  7442.    Bourne-type shell,  such as  Bash.   By  forcing the  shell script  to
  7443.    run using /bin/sh, we  are ensuring that the  script will run under  a
  7444.    Bourne-syntax shell (instead  of, say, a  C shell).   This will  cause
  7445.    your script to run using  the Bourne syntax even  if you use Tcsh  (or
  7446.    another C shell) as your login shell.
  7447.      The second  line is a  comment.  Comments  begin with the  character
  7448.    ``#'' and continue to the  end of the line.   Comments are ignored  by
  7449.    the shell---they are commonly used to identify the shell script to the
  7450.    programmer.
  7451.      The rest of the lines in the script are just  commands, as you would
  7452.    type them to the shell directly.  In effect, the shell reads each line
  7453.    of the script and runs that line  as if you had typed it at  the shell
  7454.    prompt.
  7455.      Permissions are important for shell scripts.  If  you create a shell
  7456.    script, you must  make sure that  you have  execute permission on  the
  7457.    script in order to run it(7).  The command
  7458.  
  7459.        /home/larry# chmod u+x makebook
  7460.  
  7461.    can be used to  give yourself execute  permission on the shell  script
  7462.    makebook.
  7463.  
  7464.    3.13.2 Shell variables and the environment
  7465.  
  7466.    The shell  allows  you  to  define  variables,   as  most  programming
  7467.    languages do.  A variable is  just a piece of data which is  given the
  7468.    name.
  7469. !    Note that  Tcsh, as  well as  other C-type shells,  use a  different
  7470.    mechanism for  setting  variables  than  is  described  here.     This
  7471.    discussion assumes the  use of  a Bourne  shell, such  as Bash  (which
  7472.    you're probably using).  See the Tcsh man page for details.
  7473.      When you assign  a value to a  variable (using the ``=''  operator),
  7474.    you can access  the variable  by prepending  a ``$''  to the  variable
  7475.    name, as demonstrated below.
  7476.  
  7477.        /home/larry# foo=``hello there''
  7478.  
  7479.    The variable foo  is given  the value ``hello  there''.   You can  now
  7480.    refer to  this value  by  the variable  name,  prefixed with  a  ``$''
  7481.    character.  The command
  7482.  
  7483.        /home/larry# echo $foo
  7484.        hello there
  7485.        /home/larry#
  7486.  
  7487.    produces the same results as
  7488.  
  7489.    ----------------------------
  7490.     7. When you create text files, the default permissions  usually don't
  7491.    include execute permission.
  7492.    3.13.   Customizing your Environment                               133
  7493.    _______________________________________________________________________
  7494.  
  7495.        /home/larry# echo ``hello there''
  7496.        hello there
  7497.        /home/larry#
  7498.  
  7499.      These variables  are internal to  the shell.   This means that  only
  7500.    the shell can access  these variables.   This can  be useful in  shell
  7501.    scripts; if you need to keep track of a filename, for example, you can
  7502.    store it in a variable, as above.  Using the command  set will display
  7503.    a list of all defined shell variables.
  7504.      However,   the  shell  allows  you   to  export  variables  to   the
  7505.    environment.   The  environment  is the  set  of variables  which  all
  7506.    commands that you execute have access to.  Once you  define a variable
  7507.    inside the  shell,  exporting  it  makes  that variable  part  of  the
  7508.    environment as well.  The export command is used to  export a variable
  7509.    to the environment.
  7510. !    Again, here we differ between Bash and Tcsh.   If you're using Tcsh,
  7511.    another syntax is used for  setting environment variables (the  setenv
  7512.    command is used).  See the Tcsh man page for more information.
  7513.      The environment  is very important  to the UNIX system.   It  allows
  7514.    you to configure certain commands just by setting variables  which the
  7515.    commands know about.
  7516.      Here's a quick example.   The environment variable PAGER is  used by
  7517.    the man command.    It specifies  the command  to use  to display  man
  7518.    pages one screenful at a time.   If you set PAGER to be the name  of a
  7519.    command, it will use that command to display the man pages, instead of
  7520.    more (which is the default).
  7521.      Set  PAGER to  ``cat''.    This will  cause output  from  man to  be
  7522.    displayed to  the screen  all at  once,  without breaking  it up  into
  7523.    pages.
  7524.  
  7525.        /home/larry# PAGER=``cat''
  7526.  
  7527.    Now, export PAGER to the environment.
  7528.  
  7529.        /home/larry# export PAGER
  7530.  
  7531.    Try the command  man ls.   The man  page should  fly past your  screen
  7532.    without pausing for you.
  7533.      Now, if we set PAGER  to ``more'', the more command will be  used to
  7534.    display the man page.
  7535.  
  7536.        /home/larry# PAGER=``more''
  7537.  
  7538.    Note that we  don't have  to use  the export command  after we  change
  7539.    the value  of PAGER.  We only  need  to export  a variable  once;  any
  7540.    changes made to it thereafter will automatically be propagated  to the
  7541.    environment.
  7542.      The man pages for a particular command will tell  you if the command
  7543.    uses any environment variables; for example, the man man page explains
  7544.    that PAGER  is used  to  specify the  pager command.    Some  commands
  7545. 3.13.   Customizing your Environment                               134
  7546. _______________________________________________________________________
  7547.  
  7548. share environment variables; for example, many commands use the EDITOR
  7549. environment variable to specify the default editor to use when  one is
  7550. needed.
  7551.   The environment is also used to keep track  of important information
  7552. about your  login  session.     An example  is  the  HOME  environment
  7553. variable, which contains the name of your home directory.
  7554.  
  7555.     /home/larry/papers# echo $HOME
  7556.     /home/larry
  7557.  
  7558.   Another interesting environment  variable is PS1, which  defines the
  7559. main shell prompt.  For example,
  7560.  
  7561.     /home/larry# PS1=``Your command, please:  ''
  7562.     Your command, please:
  7563.  
  7564. To set  the prompt  back  to our  usual  (which contains  the  current
  7565. working directory followed by a ``#'' symbol),
  7566.  
  7567.     Your command, please:  PS1=``\w# ''
  7568.     /home/larry#
  7569.  
  7570. The bash man page describes the syntax used for setting the prompt.
  7571.  
  7572. 3.13.2.1 The PATH environment variable
  7573.  
  7574. When you use the ls command, how does the shell find the ls executable
  7575. itself?  In fact, ls is found  in /bin/ls on most systems.   The shell
  7576. uses the  environment variable  PATH to  locate  executable files  for
  7577. commands which you type.
  7578.   For example, your PATH variable may be set to:
  7579.  
  7580.     /bin:/usr/bin:/usr/local/bin:.
  7581.  
  7582. This is a list of directories for the shell to search,  each directory
  7583. separated by a ``:''.   When you use  the command ls, the shell  first
  7584. looks for /bin/ls, then /usr/bin/ls, and so on.
  7585.   Note that  the PATH has  nothing to do  with finding regular  files.
  7586. For example, if you use the command
  7587.  
  7588.     /home/larry# cp foo bar
  7589.  
  7590. The shell does not  use PATH to locate  the files foo and  bar---those
  7591. filenames are assumed to  be complete.   The shell  only uses PATH  to
  7592. locate the cp executable.
  7593.   This saves  you a  lot of  time;  it means  that you  don't have  to
  7594. remember where all  of the command  executables are stored.   On  many
  7595. systems, executables  are  scattered about  in  many places,  such  as
  7596. /usr/bin, /bin, or  /usr/local/bin.  Instead  of giving the  command's
  7597. full pathname (such as  /usr/bin/cp), you can  simply set PATH to  the
  7598. 3.14.   So You Want to Strike Out on Your Own?                     135
  7599. _______________________________________________________________________
  7600.  
  7601. list of directories that you want the shell to automatically search.
  7602.   Notice  that PATH  contains  ``.'',  which  is the  current  working
  7603. directory.  This allows  you to create a  shell script or program  and
  7604. run it as  a command from  your current  directory, without having  to
  7605. specify it directly (as in ./makebook).  If a directory  isn't on your
  7606. PATH, then the  shell will not  search it  for commands to  run---this
  7607. includes the current directory.
  7608.  
  7609. 3.13.3 Shell initialization scripts
  7610.  
  7611. In addition  to shell  scripts that  you create,  there  are a  number
  7612. of scripts  that the  shell itself  uses for  certain purposes.    The
  7613. most important  of  these  are your  initialization  scripts,  scripts
  7614. automatically executed by the shell when you login.
  7615.   The initialization scripts  themselves are simply shell scripts,  as
  7616. described above.   However, they  are very useful  in setting up  your
  7617. environment by executing commands automatically  when you login.   For
  7618. example, if you always  use the mail command  to check your mail  when
  7619. you login, you place the  command in your initialization script  so it
  7620. will be executed automatically.
  7621.   Both  Bash and  Tcsh distinguish  between a  login  shell and  other
  7622. invocations of the shell.  A  login shell is a shell invoked  at login
  7623. time; usually,  it's the only  shell which  you'll use.   However,  if
  7624. you ``shell out'' of  another program, such  as vi, you start  another
  7625. instance of the  shell, which isn't  your login shell.   In  addition,
  7626. whenever you  run  a shell  script,  you automatically  start  another
  7627. instance of the shell to execute the script.
  7628.   The initialization  files used by  Bash are:   /etc/profile (set  up
  7629. by the  system administrator,  executed  by all  Bash  users at  login
  7630. time), $HOME/.bash_profile (executed  by a  login Bash  session),  and
  7631. $HOME/.bashrc (executed  by all  non-login  instances of  Bash).    If
  7632. .bash_profile is not present, .profile is used instead.
  7633.   Tcsh  uses the  following  initialization scripts:    /etc/csh.login
  7634. (executed by all  Tcsh users at  login time), $HOME/.tcshrc  (executed
  7635. a login  time and  by all  new instances  of Tcsh),  and  $HOME/.login
  7636. (executed at  login time,  following  .tcshrc).    If .tcshrc  is  not
  7637. present, .cshrc is used instead.
  7638.   To fully  understand the  function of  these files,  you'll need  to
  7639. learn more about the shell itself.  Shell programming is a complicated
  7640. subject, far  beyond  the scope  of this  book.    See the  man  pages
  7641. for bash  and/or  tcsh to  learn  more  about customizing  your  shell
  7642. environment.
  7643.  
  7644.  
  7645. 3.14 So You Want to Strike Out on Your Own?
  7646.  
  7647. Hopefully we have provided enough information to give you a basic idea
  7648. of how to use the system.   Keep in mind that most of  the interesting
  7649. and important aspects  of Linux  aren't covered  here---these are  the
  7650. very basics.    With this  foundation, before  long you'll  be up  and
  7651. 3.14.   So You Want to Strike Out on Your Own?                     136
  7652. _______________________________________________________________________
  7653.  
  7654. running complicated applications and fulfilling the potential  of your
  7655. system.  If things don't seem exciting at first, don't despair---there
  7656. is much to be learned.
  7657.   One indispensable  tool for  learning about  the system  is to  read
  7658. the man pages.   While many of the  man pages may appear confusing  at
  7659. first, if you dig beneath the surface there is a wealth of information
  7660. contained therein.
  7661.   We also  suggest reading  a complete  book on using  a UNIX  system.
  7662. There is much more to UNIX than meets the eye---unfortunately, most of
  7663. it is beyond the scope of this book.  Some good UNIX books  to look at
  7664. are listed in Appendix A.
  7665.  
  7666.  
  7667.  
  7668.  
  7669.  
  7670.  
  7671.  
  7672.  
  7673. Chapter 4
  7674.  
  7675.  
  7676.  
  7677.  
  7678. System Administration
  7679.  
  7680.  
  7681.  
  7682. This chapter is an overview to Linux system  administration, including
  7683. a number  of advanced  features which  aren't  necessarily for  system
  7684. administrators only.   Just  as every dog  has its  day, every  system
  7685. has its administrator, and running the system is a  very important and
  7686. sometimes time-consuming job,  even if  you're the only  user on  your
  7687. system.
  7688.   We have tried to  cover here the most important things  about system
  7689. administration you  need to  know when  you use  Linux, in  sufficient
  7690. detail to get you comfortably started.  In order to keep  it short and
  7691. sweet, we have only covered the very basics, and have  skipped many an
  7692. important detail.   You should read  the Linux System  Administrator's
  7693. Guide if  you are  serious about  running Linux.    It  will help  you
  7694. understand better how  things work, and  how they hang  together.   At
  7695. least skim through it so that you know what it contains  and know what
  7696. kind of help you can expect from it.
  7697.  
  7698. 4.1  About Root, Hats, and the Feeling of Power
  7699.  
  7700. As you  know, UNIX  differentiates between  different users,  so  that
  7701. what they do to  each other and  to the system  can be regulated  (one
  7702. wouldn't want  anybody to  be able  to read  one's love  letters,  for
  7703. instance).  Each user is given an account, which  includes a username,
  7704. home directory, and  so on.   In  addition to  accounts given to  real
  7705. people, there are special  system-defined accounts which have  special
  7706. privileges.  The most important of these is the root  account, for the
  7707. username root.
  7708.  
  7709.  
  7710. 4.1.1 The root account
  7711.  
  7712. Ordinary users are generally restricted so that they can't do  harm to
  7713. anybody else on  the system,  just to  themselves.   File  permissions
  7714. on the system are  arranged such that  normal users aren't allowed  to
  7715. delete or modify  files in directories  shared by  all users (such  as
  7716. /bin and  /usr/bin.   Most  users also  protect their  own files  with
  7717. the appropriate file permissions so  that other users can't access  or
  7718.  
  7719.                                  137
  7720. 4.1.     About Root, Hats, and the Feeling of Power                138
  7721. _______________________________________________________________________
  7722.  
  7723. modify those files.
  7724.   There are  no such restrictions on  root.   The user root can  read,
  7725. modify, or  delete any  file  on the  system,  change permissions  and
  7726. ownerships on any file, and run special programs, such  as those which
  7727. partition the drive or create filesystems.  The basic idea is that the
  7728. person or persons who run and take care of the system logs  in as root
  7729. whenever it is necessary to  perform tasks that cannot be  executed as
  7730. a normal user.    Because root  can do anything,  it is  easy to  make
  7731. mistakes that have catastrophic consequences when logged in using this
  7732. account.
  7733.   For example,  as  a normal  user,  if you  inadvertently attempt  to
  7734. delete all of the files in /etc, the system will not permit  you to do
  7735. so.  However,  when logged in  as root, the  system won't complain  at
  7736. all.  It is very easy to trash your system when using root.   The best
  7737. way to prevent accidents is to:
  7738.  
  7739.  o  Sit on your  hands before you  press [return]  on a command  which
  7740.     may cause damage.   For example,  if you're about  to clean out  a
  7741.     directory, before hitting [return], re-read the entire command and
  7742.     make sure that it is correct.
  7743.  
  7744.  o  Don't get accustomed to using root.  The more  comfortable you are
  7745.     in the role of the root  user, the more likely you are  to confuse
  7746.     your privileges with  those of a  normal user.   For example,  you
  7747.     might think that  you're logged  in as larry,  when you're  really
  7748.     logged in as root.
  7749.  
  7750.  o  Use a different prompt  for the root account.   You should  change
  7751.     root's .bashrc or .login file to set the shell prompt to something
  7752.     other than your regular user prompt.  For example, many people use
  7753.     the character ``$'' in prompts for regular users, and  reserve the
  7754.     character ``#'' for the root user prompt.
  7755.  
  7756.  o  Only login as  root when absolutely  necessary.   And, as soon  as
  7757.     you're finished with your work as root, log out.  The less you use
  7758.     the root account, the less likely  you'll be to do damage  on your
  7759.     system.
  7760.  
  7761. Of course, there is a breed of UNIX hackers out there who use root for
  7762. virtually everything.  But every one of them has, at  some point, made
  7763. a silly mistake as root and trashed the system.  The  general rule is,
  7764. until you're familiar with the lack  of restrictions on root,  and are
  7765. comfortable using the system without such restrictions, login  as root
  7766. sparingly.
  7767.   Of course,  everyone makes  mistakes.   Linus Torvalds himself  once
  7768. accidentally deleted the entire kernel  directory tree on his  system.
  7769. Hours of work were lost forever.  Fortunately, however, because of his
  7770. knowledge of the filesystem code, he was able to reboot the system and
  7771. reconstruct the directory tree by hand on disk.
  7772.   Put another way, if you picture using the root  account as wearing a
  7773. 4.1.     About Root, Hats, and the Feeling of Power                139
  7774. _______________________________________________________________________
  7775.  
  7776. special magic hat that gives  you lots of power,  so that you can,  by
  7777. waving your hand,  destroy entire cities,  it is a good  idea to be  a
  7778. bit careful about what you  do with your hands.   Since it is  easy to
  7779. move your hand in a destructive way by accident, it is not a good idea
  7780. to wear the  magic hat when  it is not  needed, despite the  wonderful
  7781. feeling.
  7782.  
  7783. 4.1.2 Abusing the system
  7784.  
  7785. Along with  the  feeling of  power  comes  the tendency  to  do  harm.
  7786. This is  one of  the grey  areas of  UNIX system  administration,  but
  7787. everyone goes through it at  some point in time.   Most users of  UNIX
  7788. systems never have  the ability  to wield  this power---on  university
  7789. and business UNIX systems,  only the highly-paid and  highly-qualified
  7790. system administrators  ever login  as root.    In fact,  at many  such
  7791. institutions, the root  password is a  highly guarded  secret:  it  is
  7792. treated as the  Holy Grail  of the  institution.   A  large amount  of
  7793. hubbub is made about logging in as root; it is portrayed as a wise and
  7794. fearsome power, given only to an exclusive cabal.
  7795.   This kind  of attitude towards  the root  account is, quite  simply,
  7796. the kind of thing which breeds  malice and contempt.  Because  root is
  7797. so fluffed-up, when some users  have their first opportunity  to login
  7798. as root (either on  a Linux system or  elsewhere), the tendency is  to
  7799. use root's privileges  in a harmful  manner.   I have known  so-called
  7800. ``system administrators'' who  read other user's  mail, delete  user's
  7801. files without warning, and  generally behave like children when  given
  7802. such a powerful ``toy''.
  7803.   Because root has  such privilege on the  system, it takes a  certain
  7804. amount of  maturity and  self-control to  use the  account  as it  was
  7805. intended---to run the  system.   There  is an unspoken  code of  honor
  7806. which exists  between  the  system  administrator  and  the  users  on
  7807. the system.    How would  you feel  if your  system administrator  was
  7808. reading your e-mail or  looking over your  files?   There is still  no
  7809. strong legal precedent for electronic privacy on time-sharing computer
  7810. systems.  On  UNIX systems, the  root user has  the ability to  forego
  7811. all security and privacy  mechanisms on the system.   It is  important
  7812. that the system administrator develop a trusting relationship with the
  7813. users on the system.  I can't stress that enough.
  7814.  
  7815. 4.1.3 Dealing with users
  7816.  
  7817. UNIX security is rather lax by design.  Security on the  system was an
  7818. afterthought---the system was originally  developed in an  environment
  7819. where users intruding upon other users was simply unheard of.  Because
  7820. of this, even with security  measures, there is still the  ability for
  7821. normal users to do harm.
  7822.   System  administrators  can  take  two  stances  when  dealing  with
  7823. abusive users:  they can be either paranoid or trusting.  The paranoid
  7824. system administrator usually causes more harm than he or she prevents.
  7825. One of my favorite  sayings is, ``Never  attribute to malice  anything
  7826. 4.1.     About Root, Hats, and the Feeling of Power                140
  7827. _______________________________________________________________________
  7828.  
  7829. which can be attributed to stupidity.''   Put another way,  most users
  7830. don't have the  ability or knowledge  to do real  harm on the  system.
  7831. 90% of the time, when a user is causing trouble on the system (by, for
  7832. instance, filling up the user  partition with large files,  or running
  7833. multiple instances of  a large  program), the user  is simply  unaware
  7834. that what he or she is doing is a problem.  I have  come down on users
  7835. who were causing a great deal of trouble, but they  were simply acting
  7836. out of ignorance---not malice.
  7837.   When you deal  with users who  are causing potential trouble,  don't
  7838. be accusative.  The old rule of ``innocent until proven guilty'' still
  7839. holds.   It is best  to simply talk  to the  user, and question  about
  7840. the trouble, instead of causing a  confrontation.  The last  thing you
  7841. want to do  is be  on the  user's bad  side.   This will  raise a  lot
  7842. of suspicion about you---the system administrator---running the system
  7843. correctly.  If a user believes that you distrust or dislike them, they
  7844. might accuse you of deleting files or breaching privacy on the system.
  7845. This is certainly not the kind of position that you want to be in.
  7846.   If you  do find  that a user  has been  attempting to ``crack''  the
  7847. system, or was intentionally  doing harm to  the system, don't  return
  7848. the malicious  behavior with  malice of  your own.    Instead,  simply
  7849. provide a warning---but be flexible.   In many cases, you may  catch a
  7850. user ``in the act'' of doing harm to the system---give them a warning.
  7851. Tell them not to let it happen  again.  However, if you do  catch them
  7852. causing harm again,  be absolutely  sure that  it is intentional.    I
  7853. can't even begin  to describe the  number of  cases where it  appeared
  7854. as though a user was  causing trouble, when  in fact it was either  an
  7855. accident or a fault of my own.
  7856.  
  7857. 4.1.4 Setting the rules
  7858.  
  7859. The best way  to run a  system is  not with an  iron fist.   That  may
  7860. be how  you run  the military,  but  UNIX was  not  designed for  such
  7861. discipline.  It makes sense to  lay down a simple and flexible  set of
  7862. guidelines for users---but  remember, the  fewer rules  you have,  the
  7863. less chance there is of breaking them.   Even if your rules  for using
  7864. the system are perfectly  reasonable and clear,  users will always  at
  7865. times break these rules without intending to.  This is especially true
  7866. in the case of new UNIX users, who are just learning the  ropes of the
  7867. system.  It's  not patently obvious,  for example, that you  shouldn't
  7868. download a gigabyte of files and mail them to everyone  on the system.
  7869. Users need help understanding the rules, and why they are there.
  7870.   If you do specify  usage guidelines for your system, make  sure that
  7871. the reason behind a particular guideline is made clear.  If you don't,
  7872. then users will  find all  sorts of  creative ways to  get around  the
  7873. rule, and not know that they are in fact breaking it.
  7874.  
  7875. 4.1.5 What it all means
  7876.  
  7877. We can't tell you how to run your system to the last detail.   Most of
  7878. the philosophy depends on how  you're using the system.   If you  have
  7879. 4.2.     Booting the System                                        141
  7880. _______________________________________________________________________
  7881.  
  7882. many users, things  are much  different than  if you only  have a  few
  7883. users, or if you're the only user on the system.  However, it's always
  7884. a good idea---in any situation---to  understand what being the  system
  7885. administrator really means.
  7886.   Being  the system  administrator  doesn't make  you a  UNIX  wizard.
  7887. There are many  system admins  out there  who know  very little  about
  7888. UNIX. Likewise, there  are many  ``normal'' users out  there who  know
  7889. more about UNIX than any system administrator could.  Also,  being the
  7890. system administrator does  not allow  you to use  malice against  your
  7891. users.  Just because the  system gives you the privilege to  mess with
  7892. user files does not mean that you have any right to do so.
  7893.   Lastly, being  the system  administrator is really  not a big  deal.
  7894. It  doesn't  matter  if  your  system  is  a  little  386  or  a  Cray
  7895. supercomputer.  Running the system  is the same, regardless.   Knowing
  7896. the root password  isn't going to  earn you money  or fame.   It  will
  7897. allow you to maintain the system, and keep it running.  That's it.
  7898.  
  7899.  
  7900. 4.2  Booting the System
  7901.  
  7902. There are several ways to boot the system, either from  floppy or from
  7903. the hard drive.
  7904.  
  7905. 4.2.1 Using a boot floppy
  7906.  
  7907. Many people boot Linux using  a ``boot floppy'' which contains  a copy
  7908. of the Linux kernel.   This kernel has the Linux root  partition coded
  7909. into it, so it will know where to look on the hard drive  for the root
  7910. filesystem.  (The rdev command  can be used to set the  root partition
  7911. in the kernel image; see below.)   This is the type of  floppy created
  7912. by Slackware during installation, for example.
  7913.   To create  your own boot  floppy, first locate  the kernel image  on
  7914. your hard disk.  It should be in the file /Image or /etc/Image.   Some
  7915. installations use the file /vmlinux for the kernel.
  7916.   You may  instead  have a  compressed kernel.    A compressed  kernel
  7917. uncompresses itself into memory at boot  time, and takes up  much less
  7918. space on the hard drive.   If you have a compressed kernel, it  may be
  7919. found in the file /zImage or /etc/zImage.
  7920.   Once you  know  where the  kernel is,  set  the root  device in  the
  7921. kernel image to the  name of your Linux  root partition with the  rdev
  7922. command.  The format of the command is
  7923.  
  7924.     rdev <kernel-name> <root-device>
  7925.  
  7926. where <kernel-name> is the name of the  kernel image, and <root-device>
  7927. is the name of the Linux root partition.  For example, to set the root
  7928. device in the kernel /etc/Image to /dev/hda2, use the command
  7929.  
  7930.     # rdev /etc/Image /dev/hda2
  7931. 4.2.   Booting the System                                          142
  7932. _______________________________________________________________________
  7933.  
  7934.   rdev can  set  other options  in the  kernel as  well,  such as  the
  7935. default SVGA mode to use at boot time.  Just use ``rdev -h''  to get a
  7936. help message.
  7937.   After setting the root device, you can simply  copy the kernel image
  7938. to the floppy.  Whenever copying data to a floppy, it's a good idea to
  7939. MS-DOS format the floppy first.   This lays down the sector  and track
  7940. information on the floppy, so it can be detected as either high or low
  7941. density.
  7942.   For  example, to  copy the  kernel  in the  file  /etc/Image to  the
  7943. floppy in /etc/fd0, use the command
  7944.  
  7945.     # cp /etc/Image /dev/fd0
  7946.  
  7947.   This floppy should now boot Linux.
  7948.  
  7949. 4.2.2 Using LILO
  7950.  
  7951. Another method of booting is to  use LILO, a program which  resides in
  7952. the boot sector of your hard disk.  This program is  executed when the
  7953. system is booted  from the hard  disk, and  can automatically boot  up
  7954. Linux from a kernel image stored on the hard drive itself.
  7955.   LILO can  also  be used  as a  first-stage boot  loader for  several
  7956. operating systems, allowing you to select at boot time which operating
  7957. system (such  as Linux  or  MS-DOS) to  boot.    When you  boot  using
  7958. LILO, the default operating system is booted unless you  press [ctrl],
  7959. [alt], or [shift]  during the bootup sequence.   If  you press any  of
  7960. these keys, you  will be  provided with  a boot prompt,  at which  you
  7961. type the name of  the operating system to  boot (such as ``linux''  or
  7962. ``msdos'').   If you  press [tab]  at the  boot prompt,  a listing  of
  7963. available operating systems will be provided.
  7964.   The easy  way to  install LILO  is to edit  the configuration  file,
  7965. /etc/lilo.conf, and then run the command
  7966.  
  7967.     # /sbin/lilo
  7968.  
  7969.   The  LILO  configuration   file  contains  a  ``stanza''  for   each
  7970. operating system that you want to  boot.  The best way  to demonstrate
  7971. this is with an example  LILO config file.   The below setup is  for a
  7972. system which has a  Linux root partition  on /dev/hda1, and an  MS-DOS
  7973. partition on /dev/hda2.
  7974.  
  7975.     # Tell LILO to modify the boot record on /dev/hda (the first
  7976.     #                                                             non-
  7977.     SCSI hard drive). If you boot from a drive other than /dev/hda,
  7978.     # change the following line.
  7979.     boot = /dev/hda
  7980.  
  7981.     #  Name  of  the  boot  loader.  No  reason  to  modify  this  un-
  7982.     less you're doing
  7983.     # some serious hacking on LILO.
  7984. 4.3.   Shutting Down                                               143
  7985. _______________________________________________________________________
  7986.  
  7987.     install = /boot/boot.b
  7988.  
  7989.     # Have LILO perform some optimization.
  7990.     compact
  7991.  
  7992.     # Stanza for Linux root partition on /dev/hda1.
  7993.     image = /etc/Image   # Location of kernel
  7994.        label = linux     # Name of OS (for the LILO boot menu)
  7995.        root = /dev/hda1  # Location of root partition
  7996.              vga   =   ask                            #    Tell   ker-
  7997.     nel to ask for SVGA modes at boot time
  7998.  
  7999.     # Stanza for MSDOS partition on /dev/hda2.
  8000.     other = /dev/hda2    # Location of partition
  8001.        table = /dev/hda  # Location of partition table for /dev/hda2
  8002.        label = msdos     # Name of OS (for boot menu)
  8003.  
  8004.   The first  operating system stanza  in the config  file will be  the
  8005. default OS for LILO to boot.  You can select another OS to boot at the
  8006. LILO boot prompt, as discussed above.
  8007.   Remember that every  time you update the  kernel image on disk,  you
  8008. should rerun /sbin/lilo in  order for the  changes to be reflected  on
  8009. the boot sector of your drive.
  8010.   Also note  that if you use  the ``root =''  line, above, there's  no
  8011. reason to use  rdev to  set the  root partition in  the kernel  image.
  8012. LILO sets it for you at boot time.
  8013.   The Linux FAQ  (see Appendix A)  provides more information on  LILO,
  8014. including how to use LILO to boot with OS/2's Boot Manager.
  8015.  
  8016.  
  8017. 4.3 Shutting Down
  8018.  
  8019. Shutting down a  Linux system  is a  bit tricky.    Remember that  you
  8020. should never just turn off the power or hit the reset switch while the
  8021. system is running.    The kernel  keeps track  of disk  I/O in  memory
  8022. buffers.   If  you reboot  the system  without giving  the kernel  the
  8023. chance to write its buffers to disk, you can corrupt your filesystems.
  8024.   Other  precautions  are  taken at  shutdown  time  as  well.     All
  8025. processes are  sent a  signal,  which allows  them  to die  gracefully
  8026. (writing and closing all files, and so on).  Filesystems are unmounted
  8027. for safety.   If you wish,  the system can  also alert users that  the
  8028. system is going down and give them a change to log off.
  8029.   The easiest  way to  shutdown is  with the  shutdown command.    The
  8030. format of the command is
  8031.  
  8032.     shutdown <time> <warning-message>
  8033.  
  8034. The <time> argument is the time to  shutdown the system (in the format
  8035. hh:mm:ss), and <warning-message> is a  message displayed on all user's
  8036. terminals before shutdown.   Alternately,  you can  specify the <time>
  8037.    4.4.   Managing Users                                              144
  8038.    _______________________________________________________________________
  8039.  
  8040.    as ``now'', to shutdown  immediately.  The  -r option may be given  to
  8041.    shutdown to reboot the system after shutting down.
  8042.      For example, to shutdown the system at 8:00pm, use the command
  8043.  
  8044.        # shutdown -r 20:00
  8045.  
  8046.      The  command halt  may  be  used  to force  an  immediate  shutdown,
  8047.    without any  warning messages  or grace  period.   halt  is useful  if
  8048.    you're the only one using the system, and want to shut down the system
  8049.    and turn it off.
  8050. !    Don't turn  off the  power or reboot  the system  until you see  the
  8051.    message:
  8052.  
  8053.        The system is halted
  8054.  
  8055.    It  is  very  important  that  you  shutdown  the  system  ``cleanly''
  8056.    using the  shutdown or  halt  commands.    On some  systems,  pressing
  8057.    [ctrl-alt-del] will be trapped and cause a shutdown; on other systems,
  8058.    however, using  the  ``Vulcan nerve  pinch''  will reboot  the  system
  8059.    immediately and may cause disaster.
  8060.  
  8061.  
  8062.    4.4 Managing Users
  8063.  
  8064.    Whether or not  you have  many users  on your  system, it's  important
  8065.    to understand the  aspects of user  management under Linux.   Even  if
  8066.    you're the only user,  you should presumably  have a separate  account
  8067.    for yourself (an account other than root to do most of your work).
  8068.      Each person  using the system  should have his  or her own  account.
  8069.    It is  seldom  a good  idea  to have  several  people share  the  same
  8070.    account.   Not only is  security an  issue, but  accounts are used  to
  8071.    uniquely identify users to the  system.  You  need to be able to  keep
  8072.    track of who is doing what.
  8073.  
  8074.    4.4.1 User management concepts
  8075.  
  8076.    The system keeps track of a number of pieces of information about each
  8077.    user.  They are summarized below.
  8078.    username   The username  is the unique identifier given to  every user
  8079.               on  the system.   Examples  of usernames  are larry,  karl,
  8080.               and  mdw.   Letters  and digits  may be  used,  as well  as
  8081.               the  characters ``_'' (underscore)  and  ``.''    (period).
  8082.               Usernames are usually limited to 8 characters in length.
  8083.  
  8084.    user ID    The  user ID, or  UID, is  a unique number  given to  every
  8085.               user  on the system.    The system usually  keeps track  of
  8086.               information by UID, not username.
  8087.  
  8088.    group ID   The  group ID,  or GID,  is the  ID of  the user's  default
  8089.               group.    In Section  3.9 we  discussed group  permissions;
  8090. 4.4.   Managing Users                                              145
  8091. _______________________________________________________________________
  8092.  
  8093.            each  user belongs  to one or  more groups  defined by  the
  8094.            system administrator.  More about this below.
  8095.  
  8096. password   The system also stores the user's  encrypted password.  The
  8097.            passwd command is used to set and change user passwords.
  8098.  
  8099. full name  The user's  ``real name'' or ``full name'' is  stored along
  8100.            with the username.   For example, the user schmoj  may have
  8101.            the name ``Joe Schmo'' in real life.
  8102.  
  8103. home directory
  8104.            The home  directory is the directory  in which the user  is
  8105.            initially  placed at login  time.   Every user should  have
  8106.            his or her own home directory, usually found under /home.
  8107.  
  8108. login shell
  8109.            The user's  login shell is the  shell which is started  for
  8110.            the  user  at login  time.    Examples  are  /bin/bash  and
  8111.            /bin/tcsh.
  8112.   The file /etc/passwd  contains this information  about users.   Each
  8113. line in the file contains information about a single user;  the format
  8114. of each line is
  8115.  
  8116.     username:encrypted  password:UID:GID:full   name:home   direc-
  8117.     tory:login shell
  8118.  
  8119. An example might be:
  8120.  
  8121.     kiwi:Xv8Q981g71oKK:102:100:Laura Poole:/home/kiwi:/bin/bash
  8122.  
  8123.   As we can see, the first field, ``kiwi'', is the username.
  8124.   The  next  field,  ``Xv8Q981g71oKK'',  is  the  encrypted  password.
  8125. Passwords are not stored on  the system in any human-readable  format.
  8126. The password is encrypted using  itself as the secret  key.  In  other
  8127. words, you need  to know the  password to  decrypt it.   This form  of
  8128. encryption is fairly secure.
  8129.   Some systems use  ``shadow password'' in which password  information
  8130. is relegated  to  the  file  /etc/shadow.     Because  /etc/passwd  is
  8131. world-readable, /etc/shadow  provides some  degree  of extra  security
  8132. because it is not.  Shadow password provides some  other features such
  8133. as password expiration and so on;  we will not go into  these features
  8134. here.
  8135.   The third field, ``102'',  is the UID. This must be unique  for each
  8136. user.  The  fourth field, ``100'',  is the GID.  This user belongs  to
  8137. the group numbered  100.   Group information,  like user  information,
  8138. is stored  in  the  file /etc/group.     See Section  4.4.5  for  more
  8139. information.
  8140.   The fifth  field is  the user's  full name,  ``Laura Poole''.    The
  8141. last two fields are the  user's home directory (/home/kiwi) and  login
  8142. shell (/bin/bash), respectively.   It is not required that  the user's
  8143. 4.4.   Managing Users                                              146
  8144. _______________________________________________________________________
  8145.  
  8146. home directory be given the same name  as the username.  It  does help
  8147. identify the directory, however.
  8148.  
  8149. 4.4.2 Adding users
  8150.  
  8151. When adding a user, there are several  steps to be taken.   First, the
  8152. user must be  given an entry  in /etc/passwd,  with a unique  username
  8153. and UID. The GID, fullname,  and other information must  be specified.
  8154. The user's  home directory  must be  created, and  the permissions  on
  8155. the directory  set  so  that the  user  owns  the directory.     Shell
  8156. initialization files must be  provided in the  new home directory  and
  8157. other system-wide configuration must be done (for example,  setting up
  8158. a spool for incoming e-mail for the new user).
  8159.   While it  is not difficult  to add users  by hand  (I do), when  you
  8160. are running a system with many  users it is easy to  forget something.
  8161. The easiest way to  add users is to  use an interactive program  which
  8162. asks you for the  required information and  updates all of the  system
  8163. files automatically.  The name of this program is  useradd or adduser,
  8164. depending on what  software was installed.   The  man pages for  these
  8165. commands should be fairly self-explanatory.
  8166.  
  8167. 4.4.3 Deleting users
  8168.  
  8169. Similarly,  deleting users  can  be  accomplished  with  the  commands
  8170. userdel or deluser  depending on  what software was  installed on  the
  8171. system.
  8172.   If you'd like  to temporarily ``disable''  a user from logging  into
  8173. the system  (without  deleting the  user's  account), you  can  simply
  8174. prepend an asterisk (``*'') to the password field in /etc/passwd.  For
  8175. example, changing kiwi's /etc/passwd entry to
  8176.  
  8177.     kiwi:*Xv8Q981g71oKK:102:100:Laura Poole:/home/kiwi:/bin/bash
  8178.  
  8179. will restrict kiwi from logging in.
  8180.  
  8181.  
  8182. 4.4.4 Setting user attributes
  8183.  
  8184. After you have created a user,  you may need to change  attributes for
  8185. that user, such as home directory or password.  The easiest  way to do
  8186. this is to change the values directly in /etc/passwd.  To set a user's
  8187. password, use the passwd command.  For example,
  8188.  
  8189.     # passwd larry
  8190.  
  8191. will change  larry's password.    Only root  may  change other  user's
  8192. password in this manner.   Users can  change their own passwords  with
  8193. passwd as well.
  8194.   On some  systems, the commands  chfn and chsh  will be available  to
  8195. allow users to set their own fullname and login shell attributes.   If
  8196. 4.5.   Archiving and Compressing Files                             147
  8197. _______________________________________________________________________
  8198.  
  8199. not, they will have  to ask the  system administrator to change  these
  8200. attributes for them.
  8201.  
  8202. 4.4.5 Groups
  8203.  
  8204. As we  have  mentioned,  each user  belongs  to  one or  more  groups.
  8205. The only  real  importance of  group  relationships pertains  to  file
  8206. permissions, as  you'll  recall from  Section  3.9,  each file  has  a
  8207. ``group ownership'' and a set  of group permissions which defines  how
  8208. users in that group may access the file.
  8209.   There  are several  system-defined groups  such  as bin,  mail,  and
  8210. sys.  Users should  not belong to any of  these groups; they are  used
  8211. for system  file permissions.    Instead,  users should  belong to  an
  8212. individual group such  as users.    If you want  to be  cute, you  can
  8213. maintain several groups of users such as student, staff, and faculty.
  8214.   The file /etc/group contains  information about groups.   The format
  8215. of each line is
  8216.  
  8217.     group name:password:GID:other members
  8218.  
  8219. Some example groups might be:
  8220.  
  8221.     root:*:0:
  8222.     users:*:100:mdw,larry
  8223.     guest:*:200:
  8224.     other:*:250:kiwi
  8225.  
  8226. The first group,  root,  is a special  system group  reserved for  the
  8227. root account.  The  next group, users, is for  regular users.   It has
  8228. a GID of  100.   The  users mdw  and larry  are given  access to  this
  8229. group.   Remember that in  /etc/passwd each user  was given a  default
  8230. GID. However, users may belong to more than one group, by adding their
  8231. usernames to other  group lines  in /etc/group.    The groups  command
  8232. lists what groups you are given access to.
  8233.   The  third group,  guest,  is  for guest  users,  and other  is  for
  8234. ``other'' users.  The user kiwi is given access to this group as well.
  8235.   As you  can  see, the  ``password'' field  of  /etc/group is  rarely
  8236. used.  It is sometimes used to  set a password on group access.   This
  8237. is seldom necessary.   To protect users from changing  into priveleged
  8238. groups (with the newgroup command), set the password field to ``*''.
  8239.   The commands  addgroup  or groupadd  may be  used to  add groups  to
  8240. your system.  Usually, it's  easier just to add entries  in /etc/group
  8241. yourself, as no other configuration needs  to be done to add  a group.
  8242. To delete a group, simply delete its entry in /etc/group.
  8243.  
  8244.  
  8245. 4.5 Archiving and Compressing Files
  8246.  
  8247. Before we can talk about backups, we need to introduce  the tools used
  8248. to archive files and software on UNIX systems.
  8249. 4.5.   Archiving and Compressing Files                             148
  8250. _______________________________________________________________________
  8251.  
  8252. 4.5.1 Using tar
  8253.  
  8254. The tar command is most often used to archive files.
  8255.   The format of the tar command is
  8256.  
  8257.     tar <options> <file1> <file2> ... <fileN>
  8258.  
  8259. where <options>  is the  list  of commands  and options  for  tar, and
  8260. <file1> through <fileN> is the list of files to add or extract from the
  8261. archive.
  8262.   For example, the command
  8263.  
  8264.     # tar cvf backup.tar /etc
  8265.  
  8266. would pack all of the files  in /etc into the tar  archive backup.tar.
  8267. The first argument to tar---``cvf''---is  the tar ``command''.   ``c''
  8268. tells tar to create a new archive  file.  The ``v'' option  forces tar
  8269. into verbose mode---printing  each filename as  it is  archived.   The
  8270. ``f'' option tells  tar that  the next argument---backup.tar---is  the
  8271. name of the archive to create.   The rest of the arguments to  tar are
  8272. the file and directory names to add to the archive.
  8273.   The command
  8274.  
  8275.     # tar xvf backup.tar
  8276.  
  8277. will extract the tar file backup.tar  in the current directory.   This
  8278. can sometimes be  dangerous---when extracting files  from a tar  file,
  8279. old files are overwritten.
  8280.   Furthermore, before  extracting tar  files it is  important to  know
  8281. where the  files  should  be  unpacked.     For  example,   let's  say
  8282. you archived  the  following  files:    /etc/hosts,   /etc/group,  and
  8283. /etc/passwd.  If you use the command
  8284.  
  8285.     # tar cvf backup.tar /etc/hosts /etc/group /etc/passwd
  8286.  
  8287. the directory name /etc/ is  added to the beginning of  each filename.
  8288. In order to extract the files to the correct location,  you would need
  8289. to use the following commands:
  8290.  
  8291.     # cd /
  8292.     # tar xvf backup.tar
  8293.  
  8294. because files are  extracted with  the pathname saved  in the  archive
  8295. file.
  8296.   If, however, you archived the files with the command
  8297.  
  8298.     # cd /etc
  8299.     # tar cvf hosts group passwd
  8300.  
  8301. the directory name is not saved  in the archive file.   Therefore, you
  8302. 4.5.   Archiving and Compressing Files                             149
  8303. _______________________________________________________________________
  8304.  
  8305. would need to ``cd  /etc'' before extracting  the files.   As you  can
  8306. see, how the tar file is created makes a large difference in where you
  8307. extract it.  The command
  8308.  
  8309.     # tar tvf backup.tar
  8310.  
  8311. may be used to display an  ``index'' of the tar file  before unpacking
  8312. it.   In this  way you  can see what  directory the  filenames in  the
  8313. archive are stored relative to,  and can extract the archive  from the
  8314. correct location.
  8315.  
  8316. 4.5.2 gzip and compress
  8317.  
  8318. Unlike archiving  programs  for  MS-DOS, tar  does  not  automatically
  8319. compress files as it archives them.   Therefore, if you  are archiving
  8320. two 1-megabyte files, the resulting tar file will be  two megabytes in
  8321. size.  The gzip  command may be used to  compress a file (the  file to
  8322. compress need not be a tar file).  The command
  8323.  
  8324.     # gzip -9 backup.tar
  8325.  
  8326. will compress  backup.tar  and  leave  you  with  backup.tar.gz,   the
  8327. compressed version of the file.   The -9 switch tells gzip to  use the
  8328. highest compression factor.
  8329.   The  gunzip command  may  be  used  to uncompress  a  gzipped  file.
  8330. Equivalently, you may use ``gzip -d''.
  8331.   gzip is  a relatively  new tool  in the UNIX  community.   For  many
  8332. years, the compress  command was used  instead.   However, because  of
  8333. several factors(1), compress is being phased out.
  8334.   compressed files end in the extension .Z.  For example, backup.tar.Z
  8335. is the compressed  version of backup.tar,  while backup.tar.gz is  the
  8336. gzipped version(2).    The  uncompress command  is  used to  expand  a
  8337. compressed file; gunzip knows how to handle compressed files as well.
  8338.  
  8339. 4.5.3 Putting them together
  8340.  
  8341. Therefore, to archive a  group of files  and compress the result,  you
  8342. can use the commands:
  8343.  
  8344.     # tar cvf backup.tar /etc
  8345.     # gzip -9 backup.tar
  8346.  
  8347. ----------------------------
  8348.  1. These  factors  include  a  software patent  dispute  against  the
  8349. compress algorithm and the fact that gzip is much more  efficient than
  8350. compress.
  8351.  
  8352.  2. To  add  further  confusion,   for  some  time  the  extension  .z
  8353. (lowercase ``z'')  was used  for gzipped  files.    The official  gzip
  8354. extension is now .gz.
  8355. 4.5.   Archiving and Compressing Files                             150
  8356. _______________________________________________________________________
  8357.  
  8358. The result  will be  backup.tar.gz.    To unpack  this file,  use  the
  8359. reverse set of commands:
  8360.  
  8361.     # gunzip backup.tar.gz
  8362.     # tar xvf backup.tar
  8363.  
  8364. Of course  always make  sure that  you are  in  the correct  directory
  8365. before unpacking a tar file.
  8366.   You can use  some UNIX cleverness to do  all of this on  one command
  8367. line, as in the following:
  8368.  
  8369.     # tar cvf - /etc | gzip -9c > backup.tar.gz
  8370.  
  8371. Here, we are  sending the tar  file to ``-'',  which stands for  tar's
  8372. standard output.  This is piped to gzip, which compresses the incoming
  8373. tar file, and the result is saved in backup.tar.gz.  The  -c option to
  8374. gzip tells gzip to send its  output to stdout, which is  redirected to
  8375. backup.tar.gz.
  8376.   A single command used to unpack this archive would be:
  8377.  
  8378.     # gunzip -c backup.tar.gz | tar xvf -
  8379.  
  8380. Again, gunzip uncompresses the contents of backup.tar.gz and sends the
  8381. resulting tar file  to stdout.    This is  piped to  tar, which  reads
  8382. ``-'', this time referring to tar's standard input.
  8383.   Happily,   the  tar   command  also   includes  the   z  option   to
  8384. automatically compress/uncompress  files on  the fly,  using the  gzip
  8385. compression algorithm.
  8386.   For example, the command
  8387.  
  8388.     # tar cvfz backup.tar.gz /etc
  8389.  
  8390. is equivalent to
  8391.  
  8392.     # tar cvf backup.tar /etc
  8393.     # gzip backup.tar
  8394.  
  8395. Just as the command
  8396.  
  8397.     # tar xvfz backup.tar.Z
  8398.  
  8399. may be used instead of
  8400.  
  8401.     # uncompress backup.tar.Z
  8402.     # tar xvf backup.tar
  8403.  
  8404.   Refer to the man pages for tar and gzip for more information.
  8405. 4.6.   Using Floppies and Making Backups                           151
  8406. _______________________________________________________________________
  8407.  
  8408. 4.6 Using Floppies and Making Backups
  8409.  
  8410. Floppies are usually used as backup media.   If you don't have  a tape
  8411. drive connected to  your system,  floppy disks can  be used  (although
  8412. they are slower and somewhat less reliable).
  8413.   You may also  use floppies to hold individual  filesystems---in this
  8414. way, you can mount the floppy to access the data on it.
  8415.  
  8416. 4.6.1 Using floppies for backups
  8417.  
  8418. The easiest way  to make a  backup using floppies  is with  tar.   The
  8419. command
  8420.  
  8421.     # tar cvfzM /dev/fd0 /
  8422.  
  8423. will make a  complete backup  of your  system using  the floppy  drive
  8424. /dev/fd0.    The  ``M'' option  to  tar  allows  the backup  to  be  a
  8425. multivolume backup; that is, when one floppy is full,  tar will prompt
  8426. for the next.  The command
  8427.  
  8428.     # tar xvfzM /dev/fd0
  8429.  
  8430. can be used to restore the complete  backup.  This method can  also be
  8431. used if you have a tape drive (/dev/rmt0) connected to your system.
  8432.   Several other  programs  exist for  making multiple-volume  backups;
  8433. the backflops program found on tsx-11.mit.edu may come in handy.
  8434.   Making  a  complete   backup  of  the   system  can  be  time-   and
  8435. resource-consuming.   Most  system  administrators use  a  incremental
  8436. backup policy, in which  every month a  complete backup is taken,  and
  8437. every week only those files which have been modified in  the last week
  8438. are backed up.  In this  case, if you trash your system in  the middle
  8439. of the month, you can simply restore the last full monthly backup, and
  8440. then restore the last weekly backups as needed.
  8441.   The find command can be useful in locating  files which have changed
  8442. since a  certain  date.    Several  scripts for  managing  incremental
  8443. backups can be found on sunsite.unc.edu.
  8444.  
  8445. 4.6.2 Using floppies as filesystems
  8446.  
  8447. You can create a filesystem  on a floppy just  as you would on a  hard
  8448. drive partition.  For example,
  8449.  
  8450.     # mke2fs /dev/fd0 1440
  8451.  
  8452. creates a filesystem  on the  floppy in  /dev/fd0.   The  size of  the
  8453. filesystem must correspond to  the size of  the floppy.   High-density
  8454. 3.5" disks are 1.44 megabytes, or 1440 blocks, in size.   High-density
  8455. 5.25" disks are 1200 blocks.
  8456.   In  order to  access  the  floppy,  you must  mount  the  filesystem
  8457. contained on it.  The command
  8458.    4.7.   Upgrading and Installing New Software                       152
  8459.    _______________________________________________________________________
  8460.  
  8461.        # mount -t ext2 /dev/fd0 /mnt
  8462.  
  8463.    will mount the floppy in /dev/fd0 on the directory /mnt.   Now, all of
  8464.    the files on the  floppy will appear  under /mnt on  your drive.   The
  8465.    ``-t ext2''  specifies an  ext2fs filesystem  type.    If you  created
  8466.    another type of filesystem on the  floppy, you'll need to  specify its
  8467.    type to the mount command.
  8468.      The  ``mount  point''  (the  directory  where  you're  mounting  the
  8469.    filesystem) needs to  exist when  you use the  mount command.   If  it
  8470.    doesn't exist, simply create it with mkdir.
  8471.      See Section 4.8 for  more information on filesystems, mounting,  and
  8472.    mount points.
  8473. !    Note that any  I/O to the floppy is  buffered just as hard  disk I/O
  8474.    is.  If you change data on the floppy, you may not see the drive light
  8475.    come on until the kernel flushes its I/O buffers.  It's important that
  8476.    you not remove a floppy before you  unmount it; this can be  done with
  8477.    the command
  8478.  
  8479.        # umount /dev/fd0
  8480.  
  8481.    Do not  simply switch  floppies  as you  would  on an  MS-DOS  system;
  8482.    whenever you change floppies, umount the first one and mount the next.
  8483.  
  8484.  
  8485.    4.7 Upgrading and Installing New Software
  8486.  
  8487.    Another duty of the system  administrator is upgrading and  installing
  8488.    new software.
  8489.      The Linux  community  is very  dynamic.   New  kernel releases  come
  8490.    out every few weeks,  and other software  is updated almost as  often.
  8491.    Because of this, new Linux users often feel the need  to upgrade their
  8492.    systems constantly to keep up the the rapidly changing pace.  Not only
  8493.    is this unnecessary, it's  a waste of  time:  to  keep up with all  of
  8494.    the changes in the Linux world, you would be spending all of your time
  8495.    upgrading and none of your time using the system.
  8496.      So,  when should you  upgrade?   Some  people feel  that you  should
  8497.    upgrade when a  new distribution release  is made---for example,  when
  8498.    Slackware comes out with a new  version.  Many Linux  users completely
  8499.    reinstall their system with the  newest Slackware release every  time.
  8500.    This, also, is  a waste  of time.   In general,  changes to  Slackware
  8501.    releases are  small.    Downloading  and  reinstalling 30  disks  when
  8502.    only 10% of  the software has  been actually  modified is, of  course,
  8503.    pointless.
  8504.      The best  way to  upgrade your system  is to  do it by  hand:   only
  8505.    upgrade those  software  packages  which  you  know  that  you  should
  8506.    upgrade.   This scares a  lot of people:   they want  to know what  to
  8507.    upgrade, and  how, and  what will break  if they  don't upgrade.    In
  8508.    order to be  successful with  Linux, it's important  to overcome  your
  8509.    fears of ``doing it  yourself''--- which is  what Linux is all  about.
  8510.    In fact, once you have your system working and  all software correctly
  8511.    configured, reinstalling with  the newest release  will no doubt  wipe
  8512. 4.7.   Upgrading and Installing New Software                       153
  8513. _______________________________________________________________________
  8514.  
  8515. all of your  configuration and things  will be  broken again, just  as
  8516. they were when you first installed your system.  Setting yourself back
  8517. in this manner is  unnecessary---all that is  needed is some  know-how
  8518. about upgrading your system, and how to do it right.
  8519.   You'll find  that when  you upgrade  one component  of your  system,
  8520. other things should not break.   For example, most of the  software on
  8521. my system is left over from an ancient 0.96 MCC  Interim installation.
  8522. Yet, I run the  newest version of the  kernel and libraries with  this
  8523. software with no problem.  For the most part, senselessly upgrading to
  8524. ``keep up with the trend'' is not important at all.  This isn't MS-DOS
  8525. or Microsoft Windows.  There is no important reason to  run the newest
  8526. version of all of the  software.  If you  find that you would  like or
  8527. need features in a  new version, then  upgrade.   If not, then  don't.
  8528. In other words, only upgrade what  you have to, and when you  have to.
  8529. Don't just upgrade for the sake of  upgrading.  That will waste  a lot
  8530. of time and effort trying to keep up.
  8531.   The  most important  software  to  upgrade  on your  system  is  the
  8532. kernel, the libraries,  and the  gcc compiler.   These  are the  three
  8533. essential parts of your system, and  in some cases they all  depend on
  8534. each other for  everything to work  successfully.   Most of the  other
  8535. software on your system does not need to be upgraded periodically.
  8536.  
  8537. 4.7.1 Upgrading the kernel
  8538.  
  8539. Upgrading the kernel  is simply a  matter of  getting the sources  and
  8540. compiling them yourself.    You must  compile the  kernel yourself  in
  8541. order to enable or disable certain features, as well as to ensure that
  8542. the kernel will be optimized to run  on your machine.  The  process is
  8543. quite painless.
  8544.   The kernel sources may be retrieved from any of  the Linux FTP sites
  8545. (see Section C  for a list).   On  sunsite.unc.edu, for instance,  the
  8546. kernel sources are found  in /pub/Linux/kernel.   Kernel versions  are
  8547. numbered using a version number and a patchlevel.  For example, kernel
  8548. version 0.99 patchlevel 11  is usually written  as 0.99.pl11, or  just
  8549. 0.99.11.
  8550.   The kernel  sources are  released as  a gzipped  tar file(3).    For
  8551. example,  the  file   containing  the  0.99.pl11  kernel  sources   is
  8552. linux-0.99.11.tar.gz.
  8553.   Unpack this  tar file from  the directory /usr/src;  it creates  the
  8554. directory /usr/src/linux  which  contains the  kernel  sources.    You
  8555. should delete or rename your existing /usr/src/linux  before unpacking
  8556. the new version.
  8557.   Once  the sources  are unpacked,  you  need to  make  sure that  two
  8558.  
  8559. ----------------------------
  8560.  3. Often,  a  patch file  is  also released  for the  current  kernel
  8561. version which allows you to patch your current kernel sources from the
  8562. last patchlevel to the current one (using the program patch).  In most
  8563. cases, however, it's usually easier to install the entire  new version
  8564. of the kernel sources.
  8565. 4.7.   Upgrading and Installing New Software                       154
  8566. _______________________________________________________________________
  8567.  
  8568. symbolic links in /usr/include  are correct.   To create these  links,
  8569. use the commands
  8570.  
  8571.     # ln -sf /usr/src/linux/include/linux /usr/include/linux
  8572.     # ln -sf /usr/src/linux/include/asm /usr/include/asm
  8573.  
  8574. Once you have created these links  once, there is no reason  to create
  8575. them again when you  install the next  version of the kernel  sources.
  8576. (See Section 3.10 for more about symbolic links.)
  8577.   Note that in order to compile the kernel, you must  have the gcc and
  8578. g++ C and C++  compilers installed on  your system.   You may need  to
  8579. have the most recent versions of these compilers:  see  Section 4.7.3,
  8580. below, for more information.
  8581.   To  compile the  kernel,  first  cd  to  /usr/src/linux.    Run  the
  8582. command make  config.    This command  will prompt  you  for a  number
  8583. of configuration options,  such as what filesystem  types you wish  to
  8584. include in the new kernel.
  8585.   Next, edit  /usr/src/linux/Makefile.   Be sure  that the  definition
  8586. for ROOT_DEV is  correct---it  defines the  device  used as  the  root
  8587. filesystem at boot time.  The usual definition is
  8588.  
  8589.     ROOT_DEV = CURRENT
  8590.  
  8591. Unless you  are changing  your  root filesystem  device,  there is  no
  8592. reason to change this.
  8593.   Next,  run  the   command  make  dep  to  fix  all  of   the  source
  8594. dependencies.  This is a very important step.
  8595.   Finally,  you're ready  to compile  the kernel.    The command  make
  8596. Image will compile the  kernel and leave the  new kernel image in  the
  8597. file /usr/src/linux/Image.  Alternately, the command make  zImage will
  8598. compile a compressed kernel image,  which uncompresses itself at  boot
  8599. time and uses less drive space.
  8600.   Once you have the kernel  compiled, you need to either copy it  to a
  8601. boot floppy (with a command such as ``cp Image /dev/fd0'')  or install
  8602. it using LILO to  boot from your  hard drive.   See Section 4.2.2  for
  8603. more information.
  8604.  
  8605. 4.7.2 Upgrading the libraries
  8606.  
  8607. As mentioned before, most  of the software  on the system is  compiled
  8608. to use shared libraries, which contain common subroutines shared among
  8609. different programs.
  8610.   If you see the message
  8611.  
  8612.     Incompatible library version
  8613.  
  8614. when attempting to  run a  program, then  you need to  upgrade to  the
  8615. version of the libraries  which the program  requires.  Libraries  are
  8616. back-compatible; that is, a program  compiled to use an  older version
  8617. of the libraries  should work with  the new  version of the  libraries
  8618.    4.7.   Upgrading and Installing New Software                       155
  8619.    _______________________________________________________________________
  8620.  
  8621.    installed.  However, the reverse is not true.
  8622.      The  newest version  of the  libraries  can be  found on  the  Linux
  8623.    FTP sites.   On sunsite.unc.edu, they  are located in  /pub/Linux/GCC.
  8624.    The ``release''  files there  should explain  what files  you need  to
  8625.    download and  how  to install  them.    Briefly,  you should  get  the
  8626.    files image-version.tar.gz and inc-version.tar.gz where version is the
  8627.    version of the libraries to install, such as 4.4.1.  These are gzipped
  8628.    tar files; the image  file contains the  library images to install  in
  8629.    /lib and /usr/lib.  The inc file contains include files  to install in
  8630.    /usr/include
  8631.      The   release-version.tar.gz   should   explain   the   installation
  8632.    procedure in detail  (the exact instructions  vary for each  release).
  8633.    In general  you  need to  install  the library  .a  and .sa  files  in
  8634.    /usr/lib.  These are the libraries used at compilation time.
  8635.      In addition,  the shared  library image  files, libc.so.version  are
  8636.    installed in /lib.    These are  the shared library  images loaded  at
  8637.    runtime by programs using the libraries.  Each library  has a symbolic
  8638.    link using the major version number of the library in /lib.
  8639.      For example,  the libc  library version  4.4.1 has  a major  version
  8640.    number of 4.   The file  containing the library  is libc.so.4.4.1.   A
  8641.    symbolic link  of the  name  libc.so.4 is  also  in /lib  pointing  to
  8642.    this file.    You need  to change  this symbolic  link when  upgrading
  8643.    the libraries.    For  example,  when  upgrading from  libc.so.4.4  to
  8644.    libc.so.4.4.1, you need to  change the symbolic  link to point to  the
  8645.    new version.
  8646. !    It is very important that you change the symbolic  link in one step,
  8647.    as given below.   If you somehow  delete the symbolic link  libc.so.4,
  8648.    then programs which depend on the link (including basic utilities like
  8649.    ls and cat) will stop  working.  Use  the following command to  update
  8650.    the symbolic link libc.so.4 to point to the file libc.so.4.4.1:
  8651.  
  8652.        # ln -sf /lib/libc.so.4.4.1 /lib/libc.so.4
  8653.  
  8654.    You also need to change the symbolic link libm.so.version in  the same
  8655.    manner.  If you are upgrading to a different version  of the libraries
  8656.    substitute to appropriate filenames above.  The library release notice
  8657.    should explain the details.   (See  Section 3.10 for more  information
  8658.    about symbolic links.)
  8659.  
  8660.    4.7.3 Upgrading gcc
  8661.  
  8662.    The gcc C and C++ compiler is used to compile software on your system,
  8663.    most importantly  the kernel.    The newest  version of  gcc is  found
  8664.    on the  Linux FTP  sites.   On  sunsite.unc.edu,  it is  found in  the
  8665.    directory /pub/Linux/GCC (along with the libraries).  There  should be
  8666.    a release file for the gcc distribution detailing what files  you need
  8667.    to download and how to install them.
  8668. 4.8.   Managing Filesystems                                        156
  8669. _______________________________________________________________________
  8670.  
  8671. 4.7.4 Upgrading other software
  8672.  
  8673. Upgrading other software is usually  just a matter of downloading  the
  8674. appropriate files and  installing them.   Most  software for Linux  is
  8675. distributed at gzipped tar files, including either sources or binaries
  8676. or both.  If  binaries are not included  in the release, you may  need
  8677. to compile  them yourself;  usually,  this means  typing  make in  the
  8678. directory where the sources are held.
  8679.   Reading the  USENET newsgroup  comp.os.linux.announce for  announce-
  8680. ments of new software  releases is the easiest  way to find out  about
  8681. new software.  Whenever you  are looking for software on an  FTP site,
  8682. downloading the ls-lR index file from  the FTP site and using  grep to
  8683. find the files in question is the easiest way to locate software.   If
  8684. you have archie available to you, it can be of  assistance as well(4).
  8685. See Appendix A for more details.
  8686.   One handy  source of  Linux software is  the Slackware  distribution
  8687. disk images.   Each  disk contains a  number of  .tgz files which  are
  8688. simply gzipped tar files.   Instead of downloading the disks,  you can
  8689. download the  desired .tgz  files from  the  Slackware directories  on
  8690. the FTP site  and install  them directly.   If  you run the  Slackware
  8691. distribution, the setup command can be used to automatically  load and
  8692. install a complete series of disks.
  8693.   Again,  it's usually  not a  good idea  to  upgrade by  reinstalling
  8694. with the newest  version of Slackware,  or another  distribution.   If
  8695. you reinstall  in this  way,  you  will no  doubt wreck  your  current
  8696. installation, including user  directories and  all of your  customized
  8697. configuration.  The  best way to upgrade  software is piecewise;  that
  8698. is, if there is a program that  you use often that has a  new version,
  8699. upgrade it.   Otherwise, don't bother.   Rule of  thumb:  If it  ain't
  8700. broke, don't  fix it.    If your  current software  works, there's  no
  8701. reason to upgrade.
  8702.  
  8703.  
  8704. 4.8 Managing Filesystems
  8705.  
  8706. Another  task  of   the  system  administrator   is  taking  care   of
  8707. filesystems.   Most  of  this job  entails periodically  checking  the
  8708. filesystems for damage or corrupted files; many  systems automatically
  8709. check the filesystems at boot time.
  8710.  
  8711. 4.8.1 Mounting filesystems
  8712.  
  8713. First, a  few concepts  about filesystems.    Before  a filesystem  is
  8714. accessible to the system, it must  be mounted on some directory.   For
  8715. example, if  you have  a filesystem  on a  floppy, you  must mount  it
  8716.  
  8717. ----------------------------
  8718.  4. If  you don't  have archie,  you can  telnet to  an archie  server
  8719. such as archie.rutgers.edu,  login as ``archie''  and use the  command
  8720. ``help''
  8721.    4.8.   Managing Filesystems                                        157
  8722.    _______________________________________________________________________
  8723.  
  8724.    under some directory,  say /mnt, in  order to access  the files on  it
  8725.    (see Section 4.6.2).  After mounting the filesystem, all  of the files
  8726.    in the filesystem  appear in  that directory.    After unmounting  the
  8727.    filesystem, the directory (in this case, /mnt) will be empty.
  8728.      The same  is true  of filesystems  on the hard  drive.   The  system
  8729.    automatically mounts filesystems on your hard drive for you  at bootup
  8730.    time.  The so-called  ``root filesystem'' is mounted on  the directory
  8731.    /.  If  you have a  separate filesystem for /usr,  for example, it  is
  8732.    mounted on  /usr.   If  you only  have a  root filesystem,  all  files
  8733.    (including those in /usr) exist on that filesystem.
  8734.      The command mount is used to mount a filesystem.  The command
  8735.  
  8736.        mount -av
  8737.  
  8738.    is executed from the file /etc/rc (which is the  system initialization
  8739.    file executed  at boot  time;  see Section  4.10.1).    The mount  -av
  8740.    command obtains information on filesystems  and mount points from  the
  8741.    file /etc/fstab.  An example fstab file appears below.
  8742.  
  8743.        # device       directory      type     options
  8744.        /dev/hda2       /             ext2     defaults
  8745.        /dev/hda3       /usr          ext2     defaults
  8746.        /dev/hda4       none          swap     sw
  8747.        /proc           /proc         proc     none
  8748.  
  8749.      The  first field  is  the  device---the  name of  the  partition  to
  8750.    mount.   The second  field is the  mount point.   The  third field  is
  8751.    the filesystem type---such as  ext2 (for ext2fs)  or minix (for  Minix
  8752.    filesystems).  Table 4.1 lists the various filesystem  types available
  8753.    for Linux.(5)  Not all  of these filesystem types may be  available on
  8754.    your system; your kernel must have support for them compiled in.   See
  8755.    Section 4.7 for information on building the kernel.
  8756.      The last field  of the fstab file contains  mount options---usually,
  8757.    this is set to ``defaults''.
  8758.      As you can see, swap partitions are included  in /etc/fstab as well.
  8759.    They have a mount  directory of none,  and type swap.   The swapon  -a
  8760.    command, executed from /etc/rc as well, is used to  enable swapping on
  8761.    all swap devices listed in /etc/fstab.
  8762.      The  fstab   file  contains  one   special  entry---for  the   /proc
  8763.    filesystem.  As mentioned in  Section 3.11.1, the /proc  filesystem is
  8764.    used to store  information about system  processes, available  memory,
  8765.    and so on.   If  /proc is not  mounted, commands such  as ps will  not
  8766.    work.
  8767. !    The mount  command may  only be used  by root.   This  is to  ensure
  8768.    security on the system; you  wouldn't want regular users  mounting and
  8769.    unmounting filesystems on a whim.  There are several software packages
  8770.  
  8771.    ----------------------------
  8772.     5. This table is current as of kernel version 1.1.37.
  8773. 4.8.   Managing Filesystems                                        158
  8774. _______________________________________________________________________
  8775.  
  8776.  
  8777. Filesystem                Typename     Comment
  8778.  
  8779. Second Extended Filesystem  ext2       Most common Linux filesystem.
  8780. Extended Filesystem         ext        Superseded by ext2.
  8781. Minix Filesystem            minix      Original Minix filesystem; rarely 
  8782.                                        used.
  8783. Xia Filesystem              xia        Like ext2, but rarely used.
  8784. UMSDOS Filesystem           umsdos     Used to install Linux on an MS-DOS
  8785.                                        partition.
  8786. MS-DOS Filesystem           msdos      Used to access MS-DOS files.
  8787. /proc Filesystem            proc       Provides process information for 
  8788.                                        ps, etc.
  8789. ISO 9660 Filesystem         iso9660    Format used by most CD-ROMs.
  8790. Xenix Filesystem            xenix      Used to access files from Xenix.
  8791. System V Filesystem         sysv       Used to access files from System V 
  8792.                                        variants for the x86.
  8793. Coherent Filesystem         coherent   Used to access files from Coherent.
  8794. HPFS Filesystem             hpfs       Read-only access for HPFS partitions 
  8795.                                        (DoubleSpace).
  8796.  
  8797.                   Table 4.1:  Linux Filesystem Types
  8798.  
  8799.  
  8800.  
  8801. available which allow regular users  to mount and unmount  filesystems
  8802. (floppies in particular) without compromising system security.
  8803.   The mount  -av command  actually mounts all  filesystems other  than
  8804. the root  filesystem  (in the  table  above,  /dev/hda2).    The  root
  8805. filesystem is automatically mounted at boot time by the kernel.
  8806.   Instead of  using mount  -av, you  can mount a  filesystem by  hand.
  8807. The command
  8808.  
  8809.     # mount -t ext2 /dev/hda3 /usr
  8810.  
  8811. is equivalent to mounting the  filesystem with the entry /dev/hda3  in
  8812. the fstab example file above.
  8813.   In general,  you should never have  to mount or unmount  filesystems
  8814. by hand.  The mount -av command in /etc/rc takes care  of mounting the
  8815. filesystems at boot time.  Filesystems are automatically  unmounted by
  8816. the shutdown or halt commands before bringing the system down.
  8817.  
  8818. 4.8.2 Checking filesystems
  8819.  
  8820. It is usually  a good  idea to  check your filesystems  for damage  or
  8821. corrupt files every now  and then.   Some systems automatically  check
  8822. their filesystems  at  boot time  (with  the appropriate  commands  in
  8823. /etc/rc).
  8824.   The command used  to check a filesystem  depends on the type of  the
  8825. filesystem in question.    For ext2fs filesystems  (the most  commonly
  8826. used type), this command is e2fsck.  For example, the command
  8827.  
  8828.     # e2fsck -av /dev/hda2
  8829.  
  8830. will check  the  ext2fs  filesystem  on  /dev/hda2  and  automatically
  8831. correct any errors.
  8832.    4.9.   Using a swap file                                           159
  8833.    _______________________________________________________________________
  8834.  
  8835.      It is usually  a good idea to  unmount a filesystem before  checking
  8836.    it.  For example, the command
  8837.  
  8838.        # umount /dev/hda2
  8839.  
  8840.    will unmount the filesystem  on /dev/hda2, after  which you can  check
  8841.    it.  The one exception is that you cannot unmount the root filesystem.
  8842.    In order to check the root filesystem when it's unmounted,  you should
  8843.    use a  maintenance  boot/root diskette  (see  Section  4.11.1).    You
  8844.    also cannot  unmount  a filesystem  if  any of  the  files in  it  are
  8845.    ``busy''---that is, being used by a running process.  For example, you
  8846.    cannot unmount a filesystem if any user's current working directory is
  8847.    on that filesystem.  You  will receive a ``Device busy'' error  if you
  8848.    attempt to unmount a filesystem which is in use.
  8849.      Other filesystem  types use different forms  of the e2fsck  command,
  8850.    such as efsck  and xfsck.   On some  systems, you  can simply use  the
  8851.    command fsck, which will determine the filesystem type and execute the
  8852.    appropriate command.
  8853. !    It  is important  that  you  reboot your  system  immediately  after
  8854.    checking a mounted  filesystem if  any corrections were  made to  that
  8855.    filesystem.   (However, in  general, you  shouldn't check  filesystems
  8856.    while they  are mounted.)    For example,  if e2fsck  reports that  it
  8857.    corrected any  errors  with  the filesystem,  you  should  immediately
  8858.    shutdown -r in  order to  reboot the  system.   This is  to allow  the
  8859.    system to re-sync  its information  about the  filesystem when  e2fsck
  8860.    modifies it.
  8861.      The  /proc filesystem  never needs  to be  checked  in this  manner.
  8862.    /proc is a memory filesystem, managed directly by the kernel.
  8863.  
  8864.  
  8865.    4.9 Using a swap file
  8866.  
  8867.    Instead of reserving an individual  partition for swap space,  you can
  8868.    use a file.  However, to do so you'll need install  the Linux software
  8869.    and get everything going before you create the swap file.
  8870.      If you  have a  Linux system installed,  you can  use the  following
  8871.    commands to create a swap file.   Below, we're going to create  a swap
  8872.    file of size 8208 blocks (about 8 megs).
  8873.  
  8874.        # dd if=/dev/zero of=/swap bs=1024 count=8208
  8875.  
  8876.    This command creates  the swap file  itself.   Replace the  ``count=''
  8877.    with the size of the swap file in blocks.
  8878.  
  8879.        # mkswap /swap 8208
  8880.  
  8881.    This command will initialize the swapfile; again, replace the name and
  8882.    size of the swapfile with the appropriate values.
  8883.  
  8884.        # /etc/sync
  8885.        # swapon /swap
  8886. 4.10.   Miscellaneous Tasks                                        160
  8887. _______________________________________________________________________
  8888.  
  8889. Now we are  swapping on the  file /swap which  we have created,  after
  8890. syncing, which ensures that the file has been written to disk.
  8891.   The  one major  drawback  to using  a  swapfile  in this  manner  is
  8892. that all  access to  the swap  file is  done  through the  filesystem.
  8893. This means that  the blocks  which make up  the swap  file may not  be
  8894. contiguous.   Therefore,  performance may  not  be as  great as  using
  8895. a swap  partition, for  which  blocks are  always  contiguous and  I/O
  8896. requests are done directly to the device.
  8897.   Another drawback in using  a swapfile is the chance to  corrupt your
  8898. filesystem data---when using  large swap  files, there  is the  chance
  8899. that you can corrupt your filesystem if something goes wrong.  Keeping
  8900. your filesystems and swap partitions  separate will prevent this  from
  8901. happening.
  8902.   Using a swap  file can be very useful  if you have a  temporary need
  8903. for more swap space.  For example, if you're compiling a large program
  8904. and would like to speed things up somewhat, you can temporarily create
  8905. a swap file and use it in addition to your regular swap space.
  8906.   To get rid of a swap file, first use swapoff, as in
  8907.  
  8908.     # swapoff /swap
  8909.  
  8910. And you can safely delete the file.
  8911.  
  8912.     # rm /swap
  8913.  
  8914.   Remember that each  swap file (or partition)  may be as large as  16
  8915. megabytes, but you may  use up to 8  swap files or partitions on  your
  8916. system.
  8917.  
  8918.  
  8919. 4.10 Miscellaneous Tasks
  8920.  
  8921. Believe it or not,  there are a number  of housekeeping tasks for  the
  8922. system administrator which don't fall into any major category.
  8923.  
  8924. 4.10.1 System startup files
  8925.  
  8926. When the system boots, a number of scripts are  executed automatically
  8927. by the system before any user logs in.  Here is a  description of what
  8928. happens.
  8929.   At bootup  time,  the kernel  spawns the  process /etc/init.    init
  8930. is a program  which reads  its configuration  file, /etc/inittab,  and
  8931. spawns other processes based  on the contents  of this file.   One  of
  8932. the important processes started from inittab is the /etc/getty process
  8933. started on each virtual console.   The getty process grabs the  VC for
  8934. use, and starts a  login process on the  VC. This allows you to  login
  8935. on each VC;  if /etc/inittab does  not contain a  getty process for  a
  8936. certain VC, you will not be able to login on that VC.
  8937.   Another  process executed  from /etc/inittab  is /etc/rc,  the  main
  8938. system initialization  file.    This file  is  a simple  shell  script
  8939. 4.10.   Miscellaneous Tasks                                        161
  8940. _______________________________________________________________________
  8941.  
  8942. which executes any initialization commands  needed at boot time,  such
  8943. as mounting the  filesystems (see Section  4.8) and initializing  swap
  8944. space.
  8945.   Your  system  may execute  other  initialization  scripts  as  well,
  8946. such as /etc/rc.local.  /etc/rc.local usually  contains initialization
  8947. commands specific to  your own  system, such as  setting the  hostname
  8948. (see the next section).  rc.local may be started from  /etc/rc or from
  8949. /etc/inittab directly.
  8950.  
  8951. 4.10.2 Setting the hostname
  8952.  
  8953. In a networked environment, the hostname is used to  uniquely identify
  8954. a particular machine, while  in a standalone environment the  hostname
  8955. just gives the system personality and charm.  It's like  naming a pet:
  8956. you can always address to your dog as ``The dog,'' but  it's much more
  8957. interesting to assign the dog a name such as Spot or Woofie.
  8958.   Setting  the system's  hostname  is a  simple  matter of  using  the
  8959. hostname command.  If  you are on a  network, your hostname should  be
  8960. the full hostname  of your machine,  such as  goober.norelco.com.   If
  8961. you are not  on a network  of any  kind, you  can choose an  arbitrary
  8962. host and domainname, such as loomer.vpizza.com,  shoop.nowhere.edu, or
  8963. floof.org.
  8964.   When setting  the hostname,  the hostname  must appear  in the  file
  8965. /etc/hosts, which assigns an  IP address to each  host.  Even if  your
  8966. machine is not on a network,  you should include your own  hostname in
  8967. /etc/hosts.
  8968.   For example, if you  are not on a TCP/IP network, and  your hostname
  8969. is floof.org, simply include the following line in /etc/hosts:
  8970.  
  8971.     127.0.0.1       floof.org localhost
  8972.  
  8973. This assigns  your  hostname,   floof.org,  to  the  loopback  address
  8974. 127.0.0.1 (used if you're not on  a network).  The localhost  alias is
  8975. also assigned to this address.
  8976.   If you are  on a TCP/IP network,  however, your real IP address  and
  8977. hostname should appear in /etc/hosts.   For example, if  your hostname
  8978. is goober.norelco.com, and your IP address is 128.253.154.32,  add the
  8979. following line to /etc/hosts:
  8980.  
  8981.     128.253.154.32       goober.norelco.com
  8982.  
  8983.   If your  hostname does  not appear in  /etc/hosts, you  will not  be
  8984. able to set it.
  8985.   To  set your  hostname,  simply  use  the  hostname command.     For
  8986. example, the command
  8987.  
  8988.     # hostname -S goober.norelco.com
  8989.  
  8990. sets the hostname to goober.norelco.com.  In most cases,  the hostname
  8991. command is executed  from one  of the  system startup  files, such  as
  8992. 4.11.   What To Do In An Emergency                                 162
  8993. _______________________________________________________________________
  8994.  
  8995. /etc/rc or  /etc/rc.local.    Edit  these  two files  and  change  the
  8996. hostname command found there to set your own hostname;  upon rebooting
  8997. the system the hostname will be set to the new value.
  8998.  
  8999.  
  9000. 4.11 What To Do In An Emergency
  9001.  
  9002. On some occasions,  the system  administrator will be  faced with  the
  9003. problem of recovering from a complete disaster, such as forgetting the
  9004. root password or  trashing filesystems.    The best  advice is,  don't
  9005. panic.  Everyone makes stupid mistakes---that's the best way  to learn
  9006. about system administration:  the hard way.
  9007.   Linux is not an unstable version of UNIX. In fact,  I have had fewer
  9008. problems with system hangs  than with commercial  versions of UNIX  on
  9009. many platforms.    Linux also  benefits from  a  strong complement  of
  9010. wizards who can help you get out of a bind.
  9011.   The first step in investigating any problem is to  attempt to fix it
  9012. yourself.  Poke around,  see how things work.   Too much of  the time,
  9013. a system  administrator will  post a  desperate plea  for help  before
  9014. looking into the problem at all.   Most of the time, you'll  find that
  9015. fixing problems yourself is  actually very easy.   It  is the path  to
  9016. guruhood.
  9017.   There are very few cases where reinstalling the  system from scratch
  9018. is necessary.    Many  new users  accidentally delete  some  essential
  9019. system file, and immediately reach  for the installation disks.   This
  9020. is not a good idea.  Before taking such drastic  measures, investigate
  9021. the problem and  ask others  to help  fix things up.    In almost  all
  9022. cases, you can recover your system from a maintenance diskette.
  9023.  
  9024. 4.11.1 Recovering using a maintenance diskette
  9025.  
  9026. One indispensable tool for the  system administrator is the so  called
  9027. ``boot/root disk''---a floppy which can be booted for a complete Linux
  9028. system, independent of your hard drive.  Boot/root  disks are actually
  9029. very simple---you create a root filesystem on the floppy, place all of
  9030. the necessary utilities on it, and install LILO and  a bootable kernel
  9031. on the floppy.  Another technique is to use one floppy  for the kernel
  9032. and another for the root filesystem.   In any case, the result  is the
  9033. same:  you are running a Linux system completely from floppy.
  9034.   The canonical  example of  a boot/root  disk is  the Slackware  boot
  9035. disks(6).   These  diskettes  contain a  bootable  kernel and  a  root
  9036. filesystem, all on floppy.   They are  intended to be used to  install
  9037. the Slackware distribution, but come  in very handy when  doing system
  9038. maintenance.
  9039.   The H.J  Lu boot/root disk,  available from  /pub/Linux/GCC/rootdisk
  9040.  
  9041. ----------------------------
  9042.  6. See Section 2.1.1  for information on  downloading these from  the
  9043. Internet.  For this procedure,  you don't need to download  the entire
  9044. Slackware release---only the boot and root diskettes.
  9045. 4.11.   What To Do In An Emergency                                 163
  9046. _______________________________________________________________________
  9047.  
  9048. on sunsite.unc.edu,  is another example  of such  a maintenance  disk.
  9049. Or, if you're  ambitious, you  can create your  own.   In most  cases,
  9050. however, using  a pre-made  boot/root  disk is  much  easier and  will
  9051. probably be more complete.
  9052.   Using a boot/root disk is  very simple.  Just boot the disk  on your
  9053. system, and login as root (usually  no password).  In order  to access
  9054. the files on your hard drive, you will need to  mount your filesystems
  9055. by hand.  For example, the command
  9056.  
  9057.     # mount -t ext2 /dev/hda2 /mnt
  9058.  
  9059. will mount an  ext2fs filesystem on  /dev/hda2 under  /mnt.   Remember
  9060. that /  is  now on  the  boot/root  disk itself;   you need  to  mount
  9061. your hard drive filesystems  under some directory  in order to  access
  9062. the files.     Therefore,  /etc/passwd  on  your  hard  drive  is  now
  9063. /mnt/etc/passwd if you mount your root filesystem on /mnt.
  9064.  
  9065. 4.11.2 Fixing the root password
  9066.  
  9067. If you forget your root password, no problem.  Just boot the boot/root
  9068. disk, mount your root filesystem  on /mnt, and blank out  the password
  9069. field for root in /mnt/etc/passwd, as so:
  9070.  
  9071.     root::0:0:root:/:/bin/sh
  9072.  
  9073. Now root has  no password;  when you  reboot from the  hard drive  you
  9074. should be able to login as root and reset the password using passwd.
  9075.   Aren't you glad you learned how to use vi?   On your boot/root disk,
  9076. other editors such as Emacs  probably aren't available, but  vi should
  9077. be.
  9078.  
  9079. 4.11.3 Fixing trashed filesystems
  9080.  
  9081. If you somehow trash your filesystems, you can run e2fsck  (if you use
  9082. the ext2fs filesystem type,  that is) to  correct any damaged data  on
  9083. the filesystems from  floppy.   Other filesystem  types use  different
  9084. forms of the fsck command; see Section 4.8 for details.
  9085.   When  checking your  filesystems  from  floppy,  it's best  for  the
  9086. filesystems to not be mounted.
  9087.   One  common cause  of filesystem  damage  is superblock  corruption.
  9088. The superblock  is  the ``header''  of  the filesystem  that  contains
  9089. information on the filesystem status, size, free blocks, and so forth.
  9090. If you corrupt your superblock  (for example, by accidentally  writing
  9091. data directly  to  the filesystem's  partition),  the system  may  not
  9092. recognize the filesystem at all.  Any attempt to  mount the filesystem
  9093. could fail, and e2fsck won't be able to fix the problem.
  9094.   Happily, the ext2fs  filesystem type saves copies of  the superblock
  9095. at ``block group'' boundaries on the drive---usually, every 8K blocks.
  9096. In order to tell e2fsck to use a copy of the superblock, you can use a
  9097. command such as
  9098. 4.11.   What To Do In An Emergency                                 164
  9099. _______________________________________________________________________
  9100.  
  9101.     # e2fsck -b 8193 <partition>
  9102.  
  9103. where <partition> is  the partition  on which  the filesystem resides.
  9104. The -b 8193  option tells  e2fsck to  use the copy  of the  superblock
  9105. stored at block 8193 in the filesystem.
  9106.  
  9107. 4.11.4 Recovering lost files
  9108.  
  9109. If you accidentally deleted important files on your system, there's no
  9110. way to ``undelete'' them.   However, you  can copy the relevant  files
  9111. from the floppy  to your  hard drive.    For example,  if you  deleted
  9112. /bin/login on your  system (which  allows you to  login), simply  boot
  9113. the boot/root floppy, mount the  root filesystem on /mnt, and  use the
  9114. command
  9115.  
  9116.     # cp -a /bin/login /mnt/bin/login
  9117.  
  9118. The -a option  tells cp  to preserve  the permissions  on the  file(s)
  9119. being copied.
  9120.   Of course, if the  files you deleted weren't essential  system files
  9121. which have counterparts on the  boot/root floppy, you're out  of luck.
  9122. If you made backups, you can always restore from them.
  9123.  
  9124. 4.11.5 Fixing trashed libraries
  9125.  
  9126. If you accidentally trashed your libraries or symbolic links  in /lib,
  9127. more than likely commands  which depended on  those libraries will  no
  9128. longer run (see Section 4.7.2).  The easiest solution is  to boot your
  9129. boot/root floppy, mount your root filesystem, and fix the libraries in
  9130. /mnt/lib.
  9131.  
  9132.  
  9133.  
  9134.  
  9135.  
  9136.  
  9137.  
  9138.  
  9139. Chapter 5
  9140.  
  9141.  
  9142.  
  9143.  
  9144. Advanced Features
  9145.  
  9146.  
  9147.  
  9148. This chapter  will  introduce you  to  some  of the  more  interesting
  9149. features of Linux.   This assumes  that you have  at least basic  UNIX
  9150. experience, and understand the  information contained in the  previous
  9151. chapters.
  9152.   The most important aspect of Linux that distinguishes  it from other
  9153. implementations of UNIX is its open design and philosophy.   Linux was
  9154. not developed by  a small team  of programmers  headed by a  marketing
  9155. committee with  a  single goal  in  mind.    It  was developed  by  an
  9156. ever-increasing group  of hackers,  putting what  they  wanted into  a
  9157. homebrew UNIX system.  The  types of software and diversity  of design
  9158. in the  Linux world  is  large.    Some people  dislike this  lack  of
  9159. uniformity and conformity---however, some call it one of the strongest
  9160. qualities of Linux.
  9161.  
  9162. 5.1 The X Window System
  9163.  
  9164. The X Window  System is a  large and  powerful (and somewhat  complex)
  9165. graphics environment for UNIX systems.   The original X  Window System
  9166. code was  developed  at MIT;  commercial  vendors  have since  made  X
  9167. the industry  standard  for UNIX  platforms.    Virtually  every  UNIX
  9168. workstation in the world runs some variant of the X Window system.
  9169.   A  free port  of the  MIT  X Window  System  version 11,  release  6
  9170. (X11R6) for 80386/80486/Pentium UNIX systems  has been developed by  a
  9171. team of  programmers originally  headed by  David Wexelblat(1).    The
  9172. release, known as XFree86(2),  is available for System V/386,  386BSD,
  9173. and other x86 UNIX implementations, including Linux.   It includes all
  9174. of the required binaries, support files, libraries, and tools.
  9175.   Configuring and using  the X Window System  is far beyond the  scope
  9176. of this book.   You  are encouraged to  read The X  Window System:   A
  9177. User's Guide---see Appendix A for information  on this book.   In this
  9178.  
  9179. ----------------------------
  9180.  1. David may be reached on the Internet at dwex@XFree86.org.
  9181.  2. XFree86 is a trademark of The XFree86 Project, Inc.
  9182.  
  9183.  
  9184.  
  9185.                                  165
  9186. 5.1.   The X Window System                                         166
  9187. _______________________________________________________________________
  9188.  
  9189. section, we'll give a step-by-step  description of how to  install and
  9190. configure XFree86 for Linux, but you will have to fill in  some of the
  9191. details yourself by  reading the  documentation released with  XFree86
  9192. itself.  (This documentation is  discussed below.)  The  Linux XFree86
  9193. HOWTO is another good source of information.
  9194.  
  9195. 5.1.1 Hardware requirements
  9196.  
  9197. As of XFree86 version 3.1,  released in September 1994,  the following
  9198. video chipsets are supported.   The  documentation included with  your
  9199. video adaptor should  specify the  chipset used.   If  you are in  the
  9200. market for a new video  card, or are  buying a new machine that  comes
  9201. with a video  card, have the  vendor find out  exactly what the  make,
  9202. model, and  chipset  of the  video card  is.    This may  require  the
  9203. vendor to call technical  support on your  behalf; in general  vendors
  9204. will be happy to do  this.  Many  PC hardware vendors will state  that
  9205. the video card is  a ``standard SVGA  card'' which ``should work''  on
  9206. your system.  Explain that your software (mention Linux  and XFree86!)
  9207. does not support all  video chipsets and  that you must have  detailed
  9208. information.
  9209.   You  can  also  determine your  videocard  chipset  by  running  the
  9210. SuperProbe program included with  the XFree86 distribution.   This  is
  9211. covered in more detail below.
  9212.   The following standard SVGA chipsets are supported:
  9213.  
  9214.  o  Tseng ET3000, ET4000AX, ET4000/W32
  9215.  
  9216.  o  Western Digital/Paradise PVGA1
  9217.  
  9218.  o  Western Digital  WD90C00,  WD90C10,   WD90C11,  WD90C24,  WD90C30,
  9219.     WD90C31, WD90C33
  9220.  
  9221.  o  Genoa GVGA
  9222.  
  9223.  o  Trident TVGA8800CS,  TVGA8900B, TVGA8900C,  TVGA8900CL,  TVGA9000,
  9224.     TVGA9000i, TVGA9100B, TVGA9200CX, TVGA9320, TVGA9400CX, TVGA9420
  9225.  
  9226.  o  ATI 18800, 18800-1, 28800-2,  28800-4, 28800-5, 28800-6,  68800-3,
  9227.     68800-6, 68800AX, 68800LX, 88800
  9228.  
  9229.  o  NCR 77C22, 77C22E, 77C22E+
  9230.  
  9231.  o  Cirrus Logic  CLGD5420, CLGD5422,  CLGD5424,  CLGD5426,  CLGD5428,
  9232.     CLGD5429,  CLGD5430,  CLGD5434,   CLGD6205,  CLGD6215,   CLGD6225,
  9233.     CLGD6235, CLGD6420
  9234.  
  9235.  o  Compaq AVGA
  9236.  
  9237.  o  OAK OTI067, OTI077
  9238. 5.1.   The X Window System                                         167
  9239. _______________________________________________________________________
  9240.  
  9241.  o  Avance Logic AL2101
  9242.  
  9243.  o  MX MX68000, MX680010
  9244.  
  9245.  o  Video 7/Headland Technologies HT216-32
  9246.  
  9247.   The  following SVGA  chipsets  with  accelerated features  are  also
  9248. supported:
  9249.  
  9250.  o  8514/A (and true clones)
  9251.  
  9252.  o  ATI Mach8, Mach32
  9253.  
  9254.  o  Cirrus CLGD5420, CLGD5422, CLGD5424, CLGD5426, CLGD5428, CLGD5429,
  9255.     CLGD5430, CLGD5434, CLGD6205, CLGD6215, CLGD6225, CLGD6235
  9256.  
  9257.  o  S3 86C911, 86C924, 86C801, 86C805, 86C805i, 86C928, 86C864, 86C964
  9258.  
  9259.  o  Western Digital WD90C31, WD90C33
  9260.  
  9261.  o  Weitek P9000
  9262.  
  9263.  o  IIT AGX-014, AGX-015, AGX-016
  9264.  
  9265.  o  Tseng ET4000/W32, ET4000/W32i, ET4000/W32p
  9266.  
  9267.   Video cards  using these chipsets  are supported  on all bus  types,
  9268. including VLB and PCI.
  9269.   All of  the above  are supported  in both 256  color and  monochrome
  9270. modes,  with the  exception  of  the  Avance Logic,  MX  and  Video  7
  9271. chipsets, which  are  only supported  in  256 color  mode.    If  your
  9272. video card has enough DRAM installed,  many of the above  chipsets are
  9273. supported in 16 and 32 bits-per-pixel mode (specifically, some Mach32,
  9274. P9000, S3 and Cirrus boards).   The usual configuration is 8  bits per
  9275. pixel (that is, 256 colors).
  9276.   The monochrome server also supports generic VGA  cards, the Hercules
  9277. monochrome card,  the Hyundai  HGC1280,  Sigma LaserView,  and  Apollo
  9278. monochrome cards.   On the Compaq  AVGA, only 64k  of video memory  is
  9279. supported for the monochrome server, and the GVGA has  not been tested
  9280. with more than 64k.
  9281.   This list  will  undoubtedly expand  as time  passes.   The  release
  9282. notes for the current version  of XFree86 should contain the  complete
  9283. list of supported video chipsets.
  9284.   One  problem faced  by the  XFree86 developers  is  that some  video
  9285. card manufacturers use non-standard  mechanisms for determining  clock
  9286. frequencies used  to drive  the card.    Some  of these  manufacturers
  9287. either don't  release specifications  describing  how to  program  the
  9288. card, or they  require developers to  sign a non-disclosure  statement
  9289. to obtain the  information.   This would  obviously restrict the  free
  9290. distribution of  the  XFree86  software, something  that  the  XFree86
  9291. 5.1.   The X Window System                                         168
  9292. _______________________________________________________________________
  9293.  
  9294. development team is  not willing to  do.   For a  long time, this  has
  9295. been a problem with certain  video cards manufactured by Diamond,  but
  9296. as of release  3.1 of XFree86,  Diamond has started  to work with  the
  9297. development team to release free drivers for these cards.
  9298.   The  suggested setup  for  XFree86  under  Linux is  a  486  machine
  9299. with at least  8 megabytes  of RAM, and  a video  card with a  chipset
  9300. listed  above.     For  optimal  performance,  we   suggest  using  an
  9301. accelerated card, such as  an S3-chipset card.   You should check  the
  9302. documentation for  XFree86 and  verify that  your  particular card  is
  9303. supported before taking the plunge and purchasing  expensive hardware.
  9304. Benchmark ratings comparisons  for various  video cards under  XFree86
  9305. are posted routinely to the USENET  newsgroups comp.windows.x.i386unix
  9306. and comp.os.linux.misc.
  9307.   As  a side  note,  my  personal  Linux system  is  a  486DX2-66,  20
  9308. megabytes of RAM, and is equipped with a VLB S3-864  chipset card with
  9309. 2 megabytes of DRAM. I have  run X benchmarks on this machine  as well
  9310. as on Sun Sparc IPX workstations.  The Linux system is roughly 7 times
  9311. faster than the Sparc IPX  (for the curious, XFree86-3.1  under Linux,
  9312. with this video card,  runs at around 171,000  xstones; the Sparc  IPX
  9313. at around 24,000).   In  general, XFree86  on a  Linux system with  an
  9314. accelerated SVGA card will give you much greater performance than that
  9315. found on  commercial UNIX  workstations (which  usually employ  simple
  9316. framebuffers for graphics).
  9317.   Your machine  will need at  least 4 megabytes  of physical RAM,  and
  9318. 16 megabytes  of virtual  RAM  (for example,  8  megs physical  and  8
  9319. megs swap).  Remember  that the more physical  RAM that you have,  the
  9320. less that the system will  swap to and from  disk when memory is  low.
  9321. Because swapping is inherently slow  (disks are very slow compared  to
  9322. memory), having 8 megabytes of RAM or more is necessary to run XFree86
  9323. comfortably.  A system with 4 megabytes of physical RAM could run much
  9324. (up to 10 times) more slowly than one with 8 megs or more.
  9325.  
  9326. 5.1.2 Installing XFree86
  9327.  
  9328. The Linux binary  distribution of  XFree86 can  be found  on a  number
  9329. of FTP  sites.   On  sunsite.unc.edu,  it is  found  in the  directory
  9330. /pub/Linux/X11.  (As of the time of this writing,  the current version
  9331. is 3.1; newer versions are released periodically).
  9332.   It's quite  likely  that you  obtained XFree86  as part  of a  Linux
  9333. distribution, in which case downloading the software separately is not
  9334. necessary.
  9335.   If you are downloading XFree86 directly, This table  lists the files
  9336. in the XFree86-3.1 distribution.
  9337.   One of the following servers is required:
  9338. 5.1.   The X Window System                                         169
  9339.  
  9340.      File                    Description
  9341.      
  9342.      XF86-3.1-8514.tar.gz    Server for 8514-based boards.
  9343.      XF86-3.1-AGX.tar.gz     Server for AGX-based boards.
  9344.      XF86-3.1-Mach32.tar.gz  Server for Mach32-based boards.
  9345.      XF86-3.1-Mach8.tar.gz   Server for Mach8-based boards.
  9346.      XF86-3.1-Mono.tar.gz    Server for monochrome video modes.
  9347.      XF86-3.1-P9000.tar.gz   Server for P9000-based boards.
  9348.      XF86-3.1-S3.tar.gz      Server for S3-based boards.
  9349.      XF86-3.1-SVGA.tar.gz    Server for Super VGA-based boards.
  9350.      XF86-3.1-VGA16.tar.gz   Server for VGA/EGA-based boards.
  9351.      XF86-3.1-W32.tar.gz     Server for ET4000/W32-based boards. 
  9352.  
  9353.   All of the following files are required:
  9354.      
  9355.      File                    Description
  9356.      
  9357.      XF86-3.1-bin.tar.gz     The rest of the X11R6 binaries.
  9358.      XF86-3.1-cfg.tar.gz     Config files for xdm, xinit and fs.
  9359.      XF86-3.1-doc.tar.gz     Documentation and manpages.
  9360.      XF86-3.1-inc.tar.gz     Include files.
  9361.      XF86-3.1-lib.tar.gz     Shared X libraries and support files.
  9362.      XF86-3.1-fnt.tar.gz     Basic fonts.
  9363.  
  9364.   The following files are optional:
  9365.  
  9366.      File                    Description
  9367.     
  9368.     XF86-3.1-ctrb.tar.gz     Selected contrib programs.
  9369.     XF86-3.1-extra.tar.gz    Extra XFree86 servers and binaries.
  9370.     XF86-3.1-lkit.tar.gz     Server linkkit for customization.
  9371.     XF86-3.1-fnt75.tar.gz    75-dpi screen fonts.
  9372.     XF86-3.1-fnt100.tar.gz   100-dpi screen fonts.
  9373.     XF86-3.1-fntbig.tar.gz   Large Kanji and other fonts.
  9374.     XF86-3.1-fntscl.tar.gz   Scaled fonts (Speedo, Type1).
  9375.     XF86-3.1-man.tar.gz      Manual pages.
  9376.     XF86-3.1-pex.tar.gz      PEX binaries, includes and libraries.
  9377.     XF86-3.1-slib.tar.gz     Static X libraries and support files.
  9378.     XF86-3.1-usrbin.tar.gz   Daemons which reside in /usr/bin.
  9379.     XF86-3.1-xdmshdw.tar.gz  Shadow password version of xdm.
  9380.  
  9381.   The XFree86 directory  should contain README files and  installation
  9382. notes for the current version.
  9383.   All that  is  required to  install XFree86  is to  obtain the  above
  9384. files, create the directory /usr/X11R6 (as root), and unpack the files
  9385. from /usr/X11R6 with a command such as:
  9386.  
  9387.     # gzip --dc XF86-3.1-bin.tar.gz | tar xfB --
  9388.  
  9389.  
  9390. Remember that these tar  files are packed  relative to /usr/X11R6,  so
  9391. it's important to unpack the files there.
  9392.   After  unpacking  the  files,  you  first  need  to  link  the  file
  9393. 5.1.   The X Window System                                         170
  9394. _______________________________________________________________________
  9395.  
  9396. /usr/X11R6/bin/X to the server that you're using.  For example, if you
  9397. wish to use  the SVGA  color server, /usr/bin/X11/X  should be  linked
  9398. to /usr/X11R6/bin/XF86_SVGA. If you  wish to use the  monochrome server
  9399. instead, relink this file to XF86_MONO with the command
  9400.  
  9401.     # ln --sf /usr/X11R6/bin/XF86_MONO  /usr/X11R6/bin/X
  9402.  
  9403. The same holds true if you are using one of the other servers.
  9404.   If  you  aren't  sure which  server  to  use,  or  don't  know  your
  9405. video card  chipset,  you can  run  the  SuperProbe program  found  in
  9406. /usr/X11R6/bin (included  in the  XF86-3.1-bin listed  above).    This
  9407. program will attempt to  determine your video  chipset type and  other
  9408. information; write down its output for later reference.
  9409.   You  need  to  make  sure  that  /usr/X11R6/bin  is  on  your  path.
  9410. This can  be  done by  editing  your  system default  /etc/profile  or
  9411. /etc/csh.login (based on the  shell that you,  or other users on  your
  9412. system, use).   Or you can simply  add the directory to your  personal
  9413. path by modifying /etc/.bashrc or /etc/.cshrc, based on your shell.
  9414.   You also  need to make  sure that /usr/X11R6/lib  can be located  by
  9415. ld.so, the runtime linker.  To do this, add the line
  9416.  
  9417.     /usr/X11R6/lib
  9418.  
  9419. to the file /etc/ld.so.conf, and run /sbin/ldconfig, as root.
  9420.  
  9421. 5.1.3 Configuring XFree86
  9422.  
  9423. Setting up XFree86 is not  difficult in most cases.   However, if  you
  9424. happen to be using hardware for which drivers ar under development, or
  9425. wish to obtain the best performance or resolution from  an accelerated
  9426. graphics card, configuring XFree86 can be somewhat time-consuming.
  9427.   In  this  section we  will  describe  how  to create  and  edit  the
  9428. XF86Config file, which configures the  XFree86 server.  In  many cases
  9429. it is  best  to start  out  with  a ``basic''  XFree86  configuration,
  9430. one which uses  a low  resolution, such  as 640x480,  which should  be
  9431. supported on  all  video cards  and  monitor types.    Once  you  have
  9432. XFree86 working at  a lower,  standard resolution,  you can tweak  the
  9433. configuration to exploit the capabilities of your video hardware.  The
  9434. idea is  that you  want to  know that  XFree86 works  at  all on  your
  9435. system, and that something isn't wrong with your  installation, before
  9436. attempting the sometimes difficult task of setting up XFree86 for real
  9437. use.
  9438.   In addition  to the  information listed  here, you  should read  the
  9439. following documentation:
  9440.  
  9441.  o  The XFree86  documentation  in  /usr/X11R6/lib/X11/doc  (contained
  9442.     within the  XFree86-3.1-doc  package).     You  should  especially
  9443.     see the  file README.Config,  which  is an  XFree86  configuration
  9444.     tutorial.
  9445.    5.1.  The X Window System                                          171
  9446.    _______________________________________________________________________
  9447.  
  9448.     o  Several video chipsets  have separate  README files  in the  above
  9449.        directory (such  as README.Cirrus  and README.S3).    Read one  of
  9450.        these if applicable.
  9451.  
  9452.     o  The man page for XFree86.
  9453.  
  9454.     o  The man page for XF86Config.
  9455.  
  9456.     o  The man page for the particular server that you are using (such as
  9457.        XF86_SVGA or XF86_S3).
  9458.  
  9459.      The       main       XFree86       configuration       file       is
  9460.    /usr/X11R6/lib/X11/XF86Config.      This  file  contains   information
  9461.    on your  mouse,   video  card  parameters,  and  so  on.     The  file
  9462.    XF86Config.eg is provided with the XFree86 distribution as an example.
  9463.    Copy this file to XF86Config and edit it as a starting point.
  9464.      The XF86Config man page explains the format of  this file in detail.
  9465.    Read this man page now, if you have not done so already.
  9466.      We are going  to present a sample  XF86Config file, piece by  piece.
  9467.    This file may not  look exactly like the  sample file included in  the
  9468.    XFree86 distribution, but the structure is the same.
  9469. !    Note that the  XF86Config file format  may change with each  version
  9470.    of XFree86; this information is only valid for XFree86 version 3.1.
  9471. !    Also,  you should  not  simply copy  the configuration  file  listed
  9472.    here to your  own system and  attempt to use  it.   Attempting to  use
  9473.    a configuration file which doesn't  correspond to your hardware  could
  9474.    drive the monitor at a frequency which is too high for it;  there have
  9475.    been reports of monitors  (especially fixed-frequency monitors)  being
  9476.    damaged or  destroyed by  using an  incorrectly configured  XF86Config
  9477.    file.   The  bottom line  is this:   Make  absolutely  sure that  your
  9478.    XF86Config file corresponds to your hardware before you attempt to use
  9479.    it.
  9480.      Each section  of the XF86Config  file is surrounded  by the pair  of
  9481.    lines Section "<section-name>"...EndSection.   The first  part of the
  9482.    XF86Config file is Files, which looks like this:
  9483.  
  9484.        Section "Files"
  9485.            RgbPath     "/usr/X11R6/lib/X11/rgb"
  9486.            FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
  9487.            FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
  9488.        EndSection
  9489.  
  9490.    The RgbPath line sets  the path to the  X11R6 RGB color database,  and
  9491.    each FontPath line sets the path to a directory containing  X11 fonts.
  9492.    In general you shouldn't have to modify these lines; just be sure that
  9493.    there is a FontPath entry for  each font type that you  have installed
  9494.    (that is, for each directory in /usr/X11R6/lib/X11/fonts).
  9495.      The  next section  is ServerFlags,  which  specifies several  global
  9496.    flags for the server.  In general this section is empty.
  9497. 5.1.   The X Window System                                         172
  9498. _______________________________________________________________________
  9499.  
  9500.   Section "ServerFlags"
  9501.   # Uncomment this to cause a core dump at the spot where a signal is
  9502.   # received. This may leave the console in an unusable state, but may
  9503.   # provide a better stack trace in the core dump to aid in debugging
  9504.   #    NoTrapSignals
  9505.   # ncomment this to disable the <Crtl><Alt><BS> server abort sequence
  9506.   #    DontZap
  9507.   EndSection
  9508.  
  9509. Here, we have all lines within the section commented out.
  9510.   The next section is Keyboard.  This should be fairly intuitive.
  9511.  
  9512.     Section "Keyboard"
  9513.         Protocol    "Standard"
  9514.         AutoRepeat  500 5
  9515.         ServerNumLock
  9516.     EndSection
  9517.  
  9518. Other options are available as  well---see the XF86Config file if  you
  9519. wish to modify the keyboard configuration.  The above  should work for
  9520. most systems.
  9521.   The  next section  is  Pointer which  specifies parameters  for  the
  9522. mouse device.
  9523.  
  9524.     Section "Pointer"
  9525.  
  9526.         Protocol    "MouseSystems"
  9527.         Device      "/dev/mouse"
  9528.  
  9529.     # Baudrate and SampleRate are only for some Logitech mice
  9530.     #    BaudRate   9600
  9531.     #    SampleRate 150
  9532.  
  9533.     # Emulate3Buttons is an option for 2-button Microsoft mice
  9534.     #    Emulate3Buttons
  9535.  
  9536.     # ChordMiddle is an option for some 3-button Logitech mice
  9537.     #    ChordMiddle
  9538.  
  9539.     EndSection
  9540.  
  9541. The only  options  that  you  should concern  yourself  with  now  are
  9542. Protocol and Device.  Protocol specifies the mouse protocol  that your
  9543. mouse uses (not the make or brand of mouse).  Valid types for Protocol
  9544. (under Linux---there are other  options available for other  operating
  9545. 5.1.  The X Window System                                          173
  9546. _______________________________________________________________________
  9547.  
  9548. systems) are:
  9549.  
  9550.  o  BusMouse
  9551.  
  9552.  o  Logitech
  9553.  
  9554.  o  Microsoft
  9555.  
  9556.  o  MMSeries
  9557.  
  9558.  o  Mouseman
  9559.  
  9560.  o  MouseSystems
  9561.  
  9562.  o  PS/2
  9563.  
  9564.  o  MMHitTab
  9565.  
  9566. BusMouse should be used  for the Logitech busmouse.   Note that  older
  9567. Logitech mice should use Logitech, but newer Logitech mice  use either
  9568. Microsoft or Mouseman protocols.  This is a case in which the protocol
  9569. doesn't necessarily have anything to do with the make of the mouse.
  9570.   Device specifies the  device file where  the mouse can be  accessed.
  9571. On most Linux systems,  this is /dev/mouse.   /dev/mouse is usually  a
  9572. link to the  appropriate serial  port (such as  /dev/cua0) for  serial
  9573. mice, or to the appropriate busmouse device for busmice.  At any rate,
  9574. be sure that the device file listed in Device exists.
  9575.   The next section is Monitor, which specifies  the characteristics of
  9576. your monitor.   As with other sections  in the XF86Config file,  there
  9577. may be more  than one Monitor  section.   This is  useful if you  have
  9578. multiple monitors connected to  a system, or  use the same  XF86Config
  9579. file under multiple hardware configurations.  In general,  though, you
  9580. will need a single Monitor section.
  9581.  
  9582.  Section "Monitor"
  9583.  
  9584.    Identifier  "CTX 5468 NI"
  9585.  
  9586.    # These values are for a CTX 5468NI only! Don't attempt to use
  9587.    # them with your monitor (unless you have this model)
  9588.  
  9589.    Bandwidth    60
  9590.    HorizSync    30-38,47-50
  9591.    VertRefresh  50-90
  9592.  
  9593.    # Modes:  Name   dotclock    horiz                vert
  9594.  
  9595.    ModeLine "640x480"  25       640 664 760 800      480 491 493 525
  9596.  
  9597. 5.1.   The X Window System                                         174
  9598. _______________________________________________________________________
  9599.  
  9600.    ModeLine "800x600"  36       800 824 896 1024     600 601 603 625
  9601.    ModeLine "1024x768" 65       1024 1088 1200 1328  768 783 789 818
  9602.  
  9603.  EndSection
  9604.  
  9605.   The  Identifier line  is  used to  give  an  arbitrary name  to  the
  9606. Monitor entry.  This  can be any string; you  will use it to  refer to
  9607. the Monitor entry later in the XF86Config file.
  9608.   they are listed below.
  9609.   HorizSync specifies the  valid horizontal sync frequencies for  your
  9610. monitor, in kHz.  If you have a multisync monitor, this can be a range
  9611. of values (or  several comma-separated  ranges), as  seen above.    If
  9612. you have a fixed-frequency  monitor, this will  be a list of  discrete
  9613. values, such as:
  9614.  
  9615.         HorizSync    31.5, 35.2, 37.9, 35.5, 48.95
  9616.  
  9617. Your  monitor  manual  should  list  these  values  in  the  technical
  9618. specifications  section.     If  you  do  not  have  this  information
  9619. available, you  should either contact  the manufacturer  or vendor  of
  9620. your monitor to obtain it.  There are other sources of information, as
  9621. well;
  9622.   VertRefresh specifies the valid vertical refresh  rates (or vertical
  9623. synchronization frequencies) for your monitor, in Hz.   Like HorizSync
  9624. this can be a range or a list of discrete values;  your monitor manual
  9625. should list them.
  9626.   HorizSync and  VertRefresh are  used only to  double-check that  the
  9627. monitor resolutions that you specify are in valid ranges.   This is to
  9628. reduce the chance that you  will damage your monitor by  attempting to
  9629. drive it at a frequency for which it was not designed.
  9630.   The ModeLine directive is  used to specify a single  resolution mode
  9631. for your monitor.  The format of ModeLine is
  9632.  
  9633.     ModeLine <name> <clock> <horiz-values> <vert-values>
  9634.  
  9635. <name> is an  arbitrary string,  which  you will  use to refer  to the
  9636. resolution mode later in the  file.  <dot-clock>  is the driving clock
  9637. frequency, or ``dot clock''  associated with the  resolution mode.   A
  9638. dot clock  is usually  specified in  MHz,  and is  the  rate at  which
  9639. the video card  must send pixels  to the  monitor at this  resolution.
  9640. <horiz-values> and <vert-values>  are four  numbers each  which specify
  9641. when the  electron  gun of  the  monitor  should fire,  and  when  the
  9642. horizontal and vertical sync pulses fire during a sweep.
  9643.   How can  you determine the  ModeLine values for your  monitor?   The
  9644. file VideoModes.doc, included with the XFree86 distribution, describes
  9645. in detail how to determine these values for each resolution  mode that
  9646. your monitor supports.   First of all, <clock>  must correspond to one
  9647. of the dot clock values  that your video card  can produce.  Later  in
  9648. the XF86Config file you  will specify these clocks;  you can only  use
  9649. 5.1.   The X Window System                                         175
  9650. _______________________________________________________________________
  9651.  
  9652. video modes which have a <clock> value supported by your video card.
  9653.   There are two files  included in the XFree86 distribution  which may
  9654. include ModeLine data for  your monitor.   These files are  modeDB.txt
  9655. and Monitors, both of which are found in /usr/X11R6/lib/X11/doc.
  9656.   You should start with ModeLine values for the  VESA standard monitor
  9657. timings, which  most monitors  support.    modeDB.txt includes  timing
  9658. values for VESA  standard resolutions.   In  that file,  you will  see
  9659. entries such as
  9660.  
  9661.     # 640x480@60Hz Non-Interlaced mode
  9662.     # Horizontal Sync = 31.5kHz
  9663.     # Timing: H=(0.95us, 3.81us, 1.59us), V=(0.35ms, 0.064ms, 1.02ms)
  9664.     #
  9665.     # name      clock   horizontal timing     vertical timing    flags
  9666.     "640x480"   25.175  640  664  760  800    480  491  493  525
  9667.  
  9668. This is a VESA standard  timing for a 640x480 video  mode.  It  uses a
  9669. dot clock of 25.175,  which your video card  must support to use  this
  9670. mode (more on this later).   To include  this entry in the  XF86Config
  9671. file, you'd use the line
  9672.  
  9673.     ModeLine "640x480" 25.175  640 664 760 800  480 491 493 525
  9674.  
  9675. Note that the <name> argument to  ModeLine (in this case "640x480") is
  9676. an arbitrary string---the  convention is  to name the  mode after  the
  9677. resolution, but <name>  can technically be  anything descriptive which
  9678. describes the mode to you.
  9679.   For   each  ModeLine   used   the  server   will  check   that   the
  9680. specifications for the mode fall within the range of  values specified
  9681. with Bandwidth, HorizSync and VertRefresh.  If they do not, the server
  9682. will complain when  you attempt to  start up X  (more on this  later).
  9683. For one thing, the  dot clock used by  the mode should not be  greater
  9684. than the value used for Bandwidth.  (However, in many cases it is safe
  9685. to use modes with  a slightly higher  bandwidth than your monitor  can
  9686. support.)
  9687.   If the VESA standard timings do not work for  you (you'll know after
  9688. trying to  use them  later)  then the  files modeDB.txt  and  Monitors
  9689. include specific mode values for many  monitor types.  You  can create
  9690. ModeLine entries from the values found in those two files as well.  Be
  9691. sure to only  use values for  the specific model  of monitor that  you
  9692. have.  Note  that many 14 and  15-inch monitors cannot support  higher
  9693. resolution modes, and often resolutions of 1024x768 at low dot clocks.
  9694. This means  that if  you can't  find high  resolution  modes for  your
  9695. monitor in these files,  then your monitor  probably does not  support
  9696. those resolution modes.
  9697.   If you  are completely at  a loss, and  can't find working  ModeLine
  9698. values for  your  monitor, you  can  follow  the instructions  in  the
  9699. VideoModes.doc file included in  the XFree86 distribution to  generate
  9700. ModeLine values  from  the  specifications listed  in  your  monitor's
  9701.    5.1.  The X Window System                                          176
  9702.    _______________________________________________________________________
  9703.  
  9704.    manual.   While your mileage  will certainly  vary when attempting  to
  9705.    generate ModeLine values by hand, this is a good place to  look if you
  9706.    can't find the values  that you need.   VideoModes.doc also  describes
  9707.    the format of the ModeLine directive and other aspects of  the XFree86
  9708.    server in gory detail.
  9709.      Lastly, if you do  obtain ModeLine values which are almost,  but not
  9710.    quite, right,  then it  may be possible  to simply  modify the  values
  9711.    slightly to obtain the desired result.  For example,  if while running
  9712.    XFree86 the image  on the  monitor is  shifted slightly,  or seems  to
  9713.    ``roll'', you can follow  the instructions in the VideoModes.doc  file
  9714.    to try to  fix these values.   Also,  be sure to  check the knobs  and
  9715.    controls on the  monitor itself!   In  many cases  it is necessary  to
  9716.    change the horizontal or vertical  size of the display after  starting
  9717.    up XFree86  in order  for  the image  to  be centered  and be  of  the
  9718.    appropriate size.  Having these  controls on the front of  the monitor
  9719.    can certainly make life easier.
  9720. !    You  shouldn't use  monitor  timing values  or ModeLine  values  for
  9721.    monitors other than the model that you  own.  If you attempt  to drive
  9722.    the monitor at  a frequency  for which it  was not  designed, you  can
  9723.    damage or even destroy it.
  9724.      The next section of  the XF86Config file is Device,  which specifies
  9725.    parameters for your video card.  Here is an example.
  9726.  
  9727.        Section "Device"
  9728.                Identifier "#9 GXE 64"
  9729.  
  9730.                # Nothing yet; we fill in these values later.
  9731.  
  9732.        EndSection
  9733.  
  9734.      This  section  defines  properties  for  a  particular  video  card.
  9735.    Identifier is an arbitrary  string describing the  card; you will  use
  9736.    this string to refer to the card later.
  9737.      Initially,  you  don't  need  to  include  anything  in  the  Device
  9738.    section, except for Identifier.  This is because we will  be using the
  9739.    X server itself  to probe for  the properties of  the video card,  and
  9740.    entering them into the  Device section later.   The XFree86 server  is
  9741.    capable of probing for the  video chipset, clocks, RAMDAC,  and amount
  9742.    of video RAM on the board.
  9743.      Before  we  do  this,  however,   we  need  to  finish  writing  the
  9744.    XF86Config file.   The  next section  is Screen,  which specifies  the
  9745.    monitor/video card combination to use for a particular server.
  9746.  
  9747.         Section "Screen"
  9748.             Driver     "Accel"
  9749.             Device     "#9 GXE 64"
  9750.             Monitor    "CTX 5468 NI"
  9751.             Subsection "Display"
  9752.                 Depth      16
  9753.                 Modes      "1024x768" "800x600" "640x480"
  9754. 5.1.  The X Window System                                          177
  9755. _______________________________________________________________________
  9756.  
  9757.              ViewPort   0 0
  9758.              Virtual    1024 768
  9759.          EndSubsection
  9760.      EndSection
  9761.  
  9762.   The Driver line specifies the X server that you will be  using.  The
  9763. value values for Driver are:
  9764.  
  9765.  o  Accel:    For  the  XF86_S3,   XF86_Mach32,   XF86_Mach8,  XF86_8514,
  9766.     XF86_P9000, XF86_AGX, and XF86_W32 servers;
  9767.  
  9768.  o  SVGA: For the XF86_SVGA server;
  9769.  
  9770.  o  VGA16:  For the XF86_VGA16 server;
  9771.  
  9772.  o  VGA2:  For the XF86_Mono server;
  9773.  
  9774.  o  Mono:   For the non-VGA  monochrome drivers  in the  XF86_Mono  and
  9775.     XF86_VGA16 servers.
  9776.  
  9777. You should be  sure that /usr/X11R6/bin/X  is a  symbolic link to  the
  9778. server that you are using.
  9779.   The  Device line  specifies  the Identifier  of the  Device  section
  9780. corresponding to the video  card to use  for this server.   Above,  we
  9781. created a Device section with the line
  9782.  
  9783.     Identifier "#9 GXE 64"
  9784.  
  9785. Therefore, we use "#9 GXE 64" on the Device line here.
  9786.   Similarly,  the  Monitor line  specifies  the  name of  the  Monitor
  9787. section to be  used with  this server.   Here,  "CTX 5468  NI" is  the
  9788. Identifier used in the Monitor section described above.
  9789.   Subsection  "Display"  defines several  properties  of  the  XFree86
  9790. server corresponding  to your  monitor/video card  combination.    The
  9791. XF86Config file describes all of these options in detail; most of them
  9792. are icing on the cake and not necessary to get the system working.
  9793.   The options that you should know about are:
  9794.  
  9795.  o  Depth.  Defines  the number of  color planes---the number of  bits
  9796.     per pixel.  Usually, Depth is set to 8.  For the VGA16 server, you
  9797.     would use a depth of 4,  and for the monochrome server a  depth of
  9798.     1.  If you are using an accelerated video card  with enough memory
  9799.     to support more bits per  pixel, you can set  Depth to 16, 24,  or
  9800.     32.  If you have problems  with depths higher than 8, set  it back
  9801.     to 8 and attempt to debug the problem later.
  9802.  
  9803.  o  Modes.   This is  the list  of video  mode names  which have  been
  9804.     defined using the ModeLine directive  in the Monitor section.   In
  9805.     the above section, we used ModeLines named  "1024x768", "800x600",
  9806.     and "640x48"0.  Therefore, we use a Modes line of
  9807. 5.1.   The X Window System                                         178
  9808. _______________________________________________________________________
  9809.  
  9810.                  Modes    "1024x768" "800x600" "640x480"
  9811.  
  9812.  
  9813.     The first  mode  listed on  this line  will  be the  default  when
  9814.     XFree86 starts  up.   After  XFree86 is  running,  you can  switch
  9815.     between the modes listed here using the keys [ctrl]-[alt]-[numeric
  9816.     +] and [ctrl]-[alt]-[numeric -].
  9817.  
  9818.     It might be best, when initially configuring XFree86, to use lower
  9819.     resolution video modes,  such as  640x480, which  tend to work  on
  9820.     most systems.  Once  you have the basic configuration  working you
  9821.     can modify XF86Config to support higher resolutions.
  9822.  
  9823.  o  Virtual.  Sets the virtual desktop size.  XFree86  has the ability
  9824.     to use any additional memory on your video card to extend the size
  9825.     of your desktop.    When you move  the mouse  pointer to the  edge
  9826.     of the display, the  desktop will scroll, bringing the  additional
  9827.     space into view.   Therefore, even if  you are running at a  lower
  9828.     video resolution such as 800x600, you can set Virtual to the total
  9829.     resolution which your video  card can support (a 1-megabyte  video
  9830.     card can  support 1024x768  at a  depth  of 8  bits per  pixel;  a
  9831.     2-megabyte card 1280x1024 at  depth 8, or  1024x768 at depth  16).
  9832.     Of course, the entire area will not be visible at once, but it can
  9833.     still be used.
  9834.  
  9835.     The Virtual feature is  a nice way to  utilize the memory of  your
  9836.     video card,  but it  is rather  limited.   If  you want  to use  a
  9837.     true virtual desktop, we suggest  using fvwm, or a  similar window
  9838.     manager, instead.   fvwm allows you  to have rather large  virtual
  9839.     desktops (implemented by hiding windows, and so forth,  instead of
  9840.     actually storing the entire desktop in video memory at once).  See
  9841.     the man pages  for fvwm for  more details about  this; most  Linux
  9842.     systems use fvwm by default.
  9843.  
  9844.  o  ViewPort.  If  you are using  the Virtual option described  above,
  9845.     ViewPort sets the coordinates of the upper-left-hand corner of the
  9846.     virtual desktop when  XFree86 starts  up.   Virtual 0  0 is  often
  9847.     used; if this is unspecified  then the desktop is centered  on the
  9848.     virtual desktop display (which may be undesirable to you).
  9849.  
  9850.   Many other options  for this section  exist; see the XF86Config  man
  9851. page for a complete description.  In practice these  other options are
  9852. not necessary to get XFree86 initially working.
  9853.  
  9854. 5.1.4 Filling in video card information
  9855.  
  9856. Your XF86Config  file  is now  ready  to  go,  with the  exception  of
  9857. complete information on the video card.  What we're going to do is use
  9858. the X server to probe  for the rest of  this information, and fill  it
  9859. into XF86Config.
  9860. 5.1.   The X Window System                                         179
  9861. _______________________________________________________________________
  9862.  
  9863.   Instead  of  probing  for  this  information  with   the  X  server,
  9864. the  XF86Config  values  for  many  cards  are  listed  in  the  files
  9865. modeDB.txt, AccelCards,  and  Devices.    These  files are  all  found
  9866. in /usr/X11R6/lib/X11/doc.    In addition,  there  are various  README
  9867. files for  certain chipsets.    You  should look  in  these files  for
  9868. information on your video  card, and use  that information (the  clock
  9869. values, chipset type, and any options) in the XF86Config file.  If any
  9870. information is missing, you can probe for it as described here.
  9871.   In these examples we will demonstrate configuration for  a #9 GXE 64
  9872. video card, which uses the  XF86_S3 chipset.   This card happens  to be
  9873. the one which the author uses, but the discussion here  applies to any
  9874. video card.
  9875.   The first thing to do is to determine the video  chipset used on the
  9876. card.  Running SuperProbe (found in /usr/X11R6/bin) will tell you this
  9877. information, but you need to know  the chipset name as it is  known to
  9878. the X server.
  9879.   To do this, run the command
  9880.  
  9881.     X -showconfig
  9882.  
  9883. This will give the  chipset names known  to your X  server.  (The  man
  9884. pages for each X server  list these as well.)   For example, with  the
  9885. accelerated XF86_S3 server, we obtain:
  9886.  
  9887.     XFree86 Version 3.1 / X Window System
  9888.     (protocol Version 11, revision 0, vendor release 6000)
  9889.     Operating System: Linux
  9890.     Configured drivers:
  9891.       S3: accelerated server for S3 graphics adaptors (Patchlevel 0)
  9892.           mmio_928, s3_generic
  9893.  
  9894.   The valid chipset names for this  server are mmio_928 and s3_generic.
  9895. The XF86_S3  man page  describes  these chipsets  and which  videocards
  9896. use them.    In the  case of  the #9  GXE 64  video card,  mmio_928  is
  9897. appropriate.
  9898.   If you don't  know which chipset to use,  the X server can  probe it
  9899. for you.  To do this, run the command
  9900.  
  9901.     X -probeonly > /tmp/x.out 2>&1
  9902.  
  9903. if you use bash as your shell.  If you use csh, try:
  9904.  
  9905.     X -probeonly &> /tmp/x.out
  9906.  
  9907.   You should run this  command while the system is unloaded,  that is,
  9908. while no other activity is occurring on the system.  This command will
  9909. also probe for your video card dot clocks (as seen below),  and system
  9910. load can throw off this calculation.
  9911.   The output from the  above (in /tmp/x.out should contain  lines such
  9912. as the following:
  9913. 5.1.   The X Window System                                         180
  9914. _______________________________________________________________________
  9915.  
  9916.     XFree86 Version 3.1 / X Window System
  9917.     (protocol Version 11, revision 0, vendor release 6000)
  9918.     Operating System: Linux
  9919.     Configured drivers:
  9920.       S3: accelerated server for S3 graphics adaptors (Patch level 0)
  9921.           mmio_928, s3_generic
  9922.     Several lines deleted...
  9923.     (--) S3: card type: 386/486 localbus
  9924.     (--) S3: chipset:   864 rev. 0
  9925.     (--) S3: chipset driver: mmio_928
  9926.  
  9927. Here, we see  that the  two valid  chipsets for this  server (in  this
  9928. case, XF86_S3) are mmio_928 and s3_generic.   The server probed  for and
  9929. found a video card using the mmio_928 chipset.
  9930.   In the Device  section of the XF86Config  file, add a Chipset  line,
  9931. containing the name of the chipset as determined above.  For example,
  9932.  
  9933.     Section "Device"
  9934.             # We already had Identifier here...
  9935.             Identifier "#9 GXE 64"
  9936.             # Add this line:
  9937.             Chipset "mmio_928"
  9938.     EndSection
  9939.  
  9940.   Now we need to  determine the driving clock frequencies used  by the
  9941. video card.  A driving clock frequency, or dot clock, is simply a rate
  9942. at which the video card  can send pixels to the  monitor.  As  we have
  9943. seen, each monitor resolution has a dot clock associated with it.  Now
  9944. we need to determine which dot clocks are made available  by the video
  9945. card.
  9946.   First you  should look  into the  files (modeDB.txt,  and so  forth)
  9947. mentioned above and see if your  card's clocks are listed there.   The
  9948. dot clocks will usually be a list of 8 or 16 values, all  of which are
  9949. in MHz.  For example, when  looking at modeDB.txt we see an  entry for
  9950. the Cardinal ET4000 video board, which looks like this:
  9951.  
  9952.     #      chip                           ram                     vir-
  9953.     tual   clocks                           default-mode  flags
  9954.      ET4000   1024  1024 768   25  28  38  36  40  45  32   0  "1024x768"
  9955.  
  9956. As we can see, the  dot clocks for this card  are 25, 28, 38, 36,  40,
  9957. 45, 32, and 0 MHz.
  9958.   In the  Devices section  of the XF86Config  file, you  should add  a
  9959. Clocks line containing  the list  of dot clocks  for your  card.   For
  9960. example, for the clocks above, we would add the line
  9961.  
  9962.             Clocks 25 28 38 36 40 45 32 0
  9963.  
  9964. to the Devices  section of the  file, after  Chipset.   Note that  the
  9965. 5.1.   The X Window System                                         181
  9966. _______________________________________________________________________
  9967.  
  9968. order of the clocks is important!  Don't resort the list  of clocks or
  9969. remove duplicates.
  9970.   If you cannot find  the dot clocks associated with your card,  the X
  9971. server can probe for these  as well.   Using the X -probeonly  command
  9972. described above, the output should  contain lines which look  like the
  9973. following:
  9974.  
  9975.     (--
  9976.     ) S3: clocks:  25.18  28.32  38.02  36.15  40.33  45.32  32.00  00.00
  9977.  
  9978. We could then  add a Clocks  line containing all  of these values,  as
  9979. printed.  You can use  more than one Clocks line in  XF86Config should
  9980. all of  the values  (sometimes  there are  more  than 8  clock  values
  9981. printed) not fit onto one  line.  Again, be  sure to keep the  list of
  9982. clocks in order as they are printed.
  9983.   Be sure that there is  no Clocks line (or that it is  commented out)
  9984. in the Devices section  of the file when  using X -probeonly to  probe
  9985. for the clocks.   If there is a  Clocks line present, the server  will
  9986. not probe for the clocks---it will use the values given in XF86Config.
  9987.   Note that  some accelerated  video boards use  a programmable  clock
  9988. chip.    (See the  XF86_Accel  man  page for  details;  this  generally
  9989. applies to S3, AGX, and XGA-2  boards.)  This chip  essentially allows
  9990. the X server to tell the card which dot clocks to use.  If this is the
  9991. case, then you may not find a  list of dot clocks for the card  in any
  9992. of the above files.  Or,  the list of dot clocks printed when  using X
  9993. -probeonly will only contain  one or two  discrete clock values,  with
  9994. the rest being duplicates or zero.
  9995.   For boards  which use  a programmable clock  chip, you  would use  a
  9996. ClockChip line, instead  of a  Clocks line,  in your XF86Config  file.
  9997. ClockChip gives the name of the clock chip as used by  the video card;
  9998. the man pages for each server  describe what these are.   For example,
  9999. in the file README.S3, we see  that several S3-864 video cards  use an
  10000. ``ICD2061A'' clock chip, and that we should use the line
  10001.  
  10002.             ClockChip "icd2061a"
  10003.  
  10004. instead of Clocks in the XF86Config  file.  As with Clocks,  this line
  10005. should go in the Devices section, after Chipset.
  10006.   Similarly, some accelerated cards require you to  specify the RAMDAC
  10007. chip type in the XF86Config file, using a Ramdac line.  The XF86_Accel
  10008. man page describes this option.  Usually, the X  server will correctly
  10009. probe for the RAMDAC.
  10010.   Some video card types require you to specify  several options in the
  10011. Devices section of  XF86Config.   These options  will be described  in
  10012. the man page for your  server, as well  as in the various files  (such
  10013. as README.cirrus or README.S3.   These  options are enabled using  the
  10014. Option line.  For example, the #9 GXE 64 card requires two options:
  10015.  
  10016.             Option "number_nine"
  10017.             Option "dac_8_bit"
  10018. 5.1.  The X Window System                                          182
  10019. _______________________________________________________________________
  10020.  
  10021. Usually, the X server  will work without  these options, but they  are
  10022. necessary to obtain  the best performance.   There  are too many  such
  10023. options to list  here, and they  each depend  on the particular  video
  10024. card being used.  If you must use one of these options, fear not---the
  10025. X server man  pages and various  files in /usr/X11R6/lib/X11/doc  will
  10026. tell you what they are.
  10027.   So, when you're finished,  you should end up with a  Devices section
  10028. which looks something like this:
  10029.  
  10030.     Section "Device"
  10031.             # Device section for the #9 GXE 64 only !
  10032.             Identifier "#9 GXE 64"
  10033.             Chipset "mmio_928"
  10034.             ClockChip "icd2061a"
  10035.             Option "number_nine"
  10036.             Option "dac_8_bit"
  10037.     EndSection
  10038.  
  10039. Most video cards  will require  a Clocks line,  instead of  ClockChip,
  10040. as described  above.   The  above Device  entry is  only  valid for  a
  10041. particular video card, the  #9 GXE 64.   It is  given here only as  an
  10042. example.
  10043.   There are other options  that you can include in the  Devices entry.
  10044. Check the X  server man pages  for the gritty  details, but the  above
  10045. should suffice for most systems.
  10046.  
  10047. 5.1.5 Running XFree86
  10048.  
  10049. With your XF86Config file  configured, you're ready  to fire up the  X
  10050. server and give it a spin.   First, be sure that /usr/X11R6/bin  is on
  10051. your path.
  10052.   The command to start up XFree86 is
  10053.  
  10054.     startx
  10055.  
  10056. This is a front-end to  xinit (in case you're  used to using xinit  on
  10057. other UNIX systems).
  10058.   This command will start  the X server and run the commands  found in
  10059. the file .xinitrc in your  home directory.   .xinitrc is just a  shell
  10060. script containing X clients to run.  If this file does  not exist, the
  10061. system default /usr/X11R6/lib/X11/xinit/xinitrc will be used.
  10062.   A standard .xinitrc file looks like this:
  10063.  
  10064.     #!/bin/sh
  10065.  
  10066.     xterm -fn 7x13bold -geometry 80x32+10+50 &
  10067.     xterm -fn 9x15bold -geometry 80x34+30-10 &
  10068.     oclock -geometry 70x70-7+7 &
  10069.     xsetroot -solid midnightblue &
  10070. 5.1.   The X Window System                                         183
  10071. _______________________________________________________________________
  10072.  
  10073.     exec twm
  10074.  
  10075. This script will start  up two xterm clients,  an oclock, and set  the
  10076. root window (background) color to midnightblue.  It will then start up
  10077. twm, the window manager.   Note that twm is executed with  the shell's
  10078. exec statement; this causes the xinit process to be replaced with twm.
  10079. Once the twm  process exits, the  X server  will shut down.   You  can
  10080. cause twm to exit by using the root menus:  depress mouse  button 1 on
  10081. the desktop background---this will  display a pop  up menu which  will
  10082. allow you to Exit Twm.
  10083.   Be sure that the last command in .xinitrc is  started with exec, and
  10084. that it is not placed into the background (no ampersand on  the end of
  10085. the line).  Otherwise  the X server will shut  down as soon as  it has
  10086. started the clients in the .xinitrc file.
  10087.   Alternately, you can exit X by  pressing [ctrl]-[alt]-[backspace] in
  10088. combination.  This will kill the X server directly, exiting the window
  10089. system.
  10090.   The  above is  a very,  very  simple desktop  configuration.    Many
  10091. wonderful programs and configurations are available with a bit of work
  10092. on your .xinitrc  file.   For example,  the fvwm  window manager  will
  10093. provide a virtual desktop, and you can customize colors, fonts, window
  10094. sizes and positions, and so forth  to your heart's content.   Although
  10095. the X Window  System might  appear to be  simplistic at  first, it  is
  10096. extremely powerful once you customize it for yourself.
  10097.   If you  are new  to  the X  Window System  environment, we  strongly
  10098. suggest picking up  a book  such as  The X  Window System:   A  User's
  10099. Guide.  Using  and configuring X  is far too  in-depth to cover  here.
  10100. See the man  pages for  xterm, oclock,  and twm for  clues on  getting
  10101. started.
  10102.  
  10103. 5.1.6 Running into trouble
  10104.  
  10105. Often, something will not  be quite right  when you initially fire  up
  10106. the X server.    This is  almost always caused  by a  problem in  your
  10107. XF86Config file.  Usually, the  monitor timing values are off,  or the
  10108. video card dot clocks set incorrectly.  If your display seems to roll,
  10109. or the edges are  fuzzy, this is a  clear indication that the  monitor
  10110. timing values or  dot clocks are  wrong.   Also be  sure that you  are
  10111. correctly specifying your video card chipset, as well as other options
  10112. for the Device section of XF86Config.  Be absolutely  certain that you
  10113. are using the right X  server and that /usr/X11R6/bin/X is  a symbolic
  10114. link to this server.
  10115.   If all else fails, try  to start X ``bare''; that is, use  a command
  10116. such as:
  10117.  
  10118.     X > /tmp/x.out 2>&1
  10119.  
  10120. You can then kill the X server (using the [ctrl]-[alt]-[backspace] key
  10121. combination) and examine  the contents of  /tmp/x.out.   The X  server
  10122. will report any warnings or  errors---for example, if your  video card
  10123. 5.2.   Accessing MS-DOS Files                                      184
  10124. _______________________________________________________________________
  10125.  
  10126. doesn't have a  dot clock corresponding  to a  mode supported by  your
  10127. monitor.
  10128.   The  file  VideoModes.doc  included  in  the   XFree86  distribution
  10129. contains many hints for tweaking the values in your XF86Config file.
  10130.   Remember  that you  can  use  [ctrl]-[alt]-[numeric +]  and  [ctrl]-
  10131. [alt]-[numeric  -]  to  switch  between  the  video  modes  listed  on
  10132. the Modes  line  of  the  Screen  section  of  XF86Config.     If  the
  10133. highest resolution mode  doesn't look  right, try  switching to  lower
  10134. resolutions.  This will  let you know, at  least, that those parts  of
  10135. your X configuration are working correctly.
  10136.   Also,  check the  vertical and  horizontal size/hold  knobs on  your
  10137. monitor.  In many cases it is necessary to adjust  these when starting
  10138. up X. For example, if the display seems to be shifted  slightly to one
  10139. side, you can usually correct this using the monitor controls.
  10140.   The   USENET  newsgroup   comp.windows.x.i386unix  is   devoted   to
  10141. discussions about XFree86.    It might be  a good  idea to watch  that
  10142. newsgroup for  postings  relating to  your  video  configuration---you
  10143. might run across someone with the same problems as your own.
  10144.  
  10145.  
  10146. 5.2 Accessing MS-DOS Files
  10147.  
  10148. If, for some twisted and bizarre reason, you would have need to access
  10149. files from MS-DOS, it's quite easily done under Linux.
  10150.   The  usual  way  to access  MS-DOS  files  is  to  mount  an  MS-DOS
  10151. partition or  floppy under  Linux, allowing  you to  access the  files
  10152. directly through the filesystem.   For example, if you have  an MS-DOS
  10153. floppy in /dev/fd0, the command
  10154.  
  10155.     # mount -t msdos /dev/fd0 /mnt
  10156.  
  10157. will mount it under /mnt.   See Section 4.6.2 for more  information on
  10158. mounting floppies.
  10159.   You  can also  mount an  MS-DOS  partition of  your hard  drive  for
  10160. access under Linux.  If you have an MS-DOS partition on /dev/hda1, the
  10161. command
  10162.  
  10163.     # mount -t msdos /dev/hda1 /mnt
  10164.  
  10165. will mount it.  Be sure to umount the partition when you're done using
  10166. it.  You can have your MS-DOS partitions automatically mounted at boot
  10167. time if you include  entries for them in  /etc/fstab; see Section  4.8
  10168. for details.  For example, the following line in /etc/fstab will mount
  10169. an MS-DOS partition on /dev/hda1 on the directory /dos.
  10170.  
  10171.     /dev/hda1     /dos     msdos      defaults
  10172.  
  10173.   The Mtools software  may also be used to  access MS-DOS files.   For
  10174. example, the commands mcd, mdir, and mcopy all behave  as their MS-DOS
  10175. counterparts.   If you  installed Mtools,  there should  be man  pages
  10176. available for these commands.
  10177. 5.3.   Networking with TCP/IP                                      185
  10178. _______________________________________________________________________
  10179.  
  10180.   Accessing MS-DOS  files is one thing;  running MS-DOS programs  from
  10181. Linux is another.  There  is an MS-DOS Emulator under  development for
  10182. Linux; it  is  widely available,  and even  distributed  with SLS.  It
  10183. can be retrieved  from a  number of locations,  including the  various
  10184. Linux FTP sites (see Appendix C for details).  The  MS-DOS Emulator is
  10185. reportedly powerful enough to run a number of  applications, including
  10186. Wordperfect, from  Linux.     However,  Linux and  MS-DOS  are  vastly
  10187. different operating systems.   The power of any MS-DOS  emulator under
  10188. UNIX is somewhat limited.
  10189.   In addition,  work is  underway on a  Microsoft Windows emulator  to
  10190. run under X  Windows.   Watch the  newsgroups and  FTP sites for  more
  10191. information.
  10192.  
  10193.  
  10194. 5.3 Networking with TCP/IP
  10195.  
  10196. Linux supports a full implementation of the TCP/IP  (Transport Control
  10197. Protocol/Internet Protocol) networking protocols.   TCP/IP has  become
  10198. the most  successful  mechanism for  networking  computers  worldwide.
  10199. With Linux and  an Ethernet card,  you can network  your machine to  a
  10200. local area network, or (with  the proper network connections),  to the
  10201. Internet---the worldwide TCP/IP network.
  10202.   Hooking  up a  small  LAN of  UNIX  machines is  easy.    It  simply
  10203. requires an Ethernet  controller in each  machine and the  appropriate
  10204. Ethernet cables  and  other  hardware.     Or,  if  your  business  or
  10205. university provides access to  the Internet, you  can easily add  your
  10206. Linux machine to this network.
  10207.   The  current implementation  of  TCP/IP  and related  protocols  for
  10208. Linux is called ``NET-2''.  This has no relationship  to the so-called
  10209. NET-2 release of BSD  UNIX; instead, ``NET-2''  in this context  means
  10210. the second implementation of TCP/IP for Linux.
  10211.   Linux  NET-2 also  supports  SLIP---Serial Line  Internet  Protocol.
  10212. SLIP allows you to have dialup Internet access using a modem.  If your
  10213. business or university provides  SLIP access, you  can dial in to  the
  10214. SLIP server and put your machine on the Internet over  the phone line.
  10215. Alternately, if your  Linux machine  also has Ethernet  access to  the
  10216. Internet, you can set up your Linux box as a SLIP server.
  10217.   For  complete information  on  setting  up TCP/IP  under  Linux,  we
  10218. encourage you to read the  Linux NET-2 HOWTO, available via  anonymous
  10219. FTP from sunsite.unc.edu.    The NET-2  HOWTO is a  complete guide  to
  10220. configuring TCP/IP,  including Ethernet  and SLIP  connections,  under
  10221. Linux.  The Linux Ethernet HOWTO is a related  document that describes
  10222. configuration of various Ethernet card  drivers for Linux.   The Linux
  10223. Network Administrator's Guide, from  the Linux Documentation  Project,
  10224. is also  available.   See  Appendix A  for more  information on  these
  10225. documents.
  10226.   Also  of interest  is the  book  TCP/IP Network  Administration,  by
  10227. Craig Hunt.  It contains complete information on using and configuring
  10228. TCP/IP on UNIX systems.
  10229. 5.3.   Networking with TCP/IP                                      186
  10230. _______________________________________________________________________
  10231.  
  10232. 5.3.1 Hardware Requirements
  10233.  
  10234. You  can  use  Linux  TCP/IP   without  any  networking  hardware   at
  10235. all---configuring ``loopback'' mode  allows you  to talk to  yourself.
  10236. This is  necessary  for some  applications  and  games which  use  the
  10237. ``loopback'' network device.
  10238.   However, if you want  to use Linux with an Ethernet  TCP/IP network,
  10239. you need one of the following  Ethernet cards:  3com 3c503,  3c503/16;
  10240. Novell NE1000, NE2000; Western Digital WD8003, WD8013; Hewlett Packard
  10241. HP27245, HP27247, HP27250.
  10242.   The following clones are reported to work:   WD-80x3 clones:  LANNET
  10243. LEC-45; NE2000 clones:   Alta Combo,  Artisoft LANtastic AE-2,  Asante
  10244. Etherpak 2001/2003, D-Link Ethernet II, LTC E-NET/16 P/N 8300-200-002,
  10245. Network Solutions  HE-203,  SVEC  4  Dimension  Ethernet,  4-Dimension
  10246. FD0490 EtherBoard 16, and D-Link DE-600, SMC Elite 16.
  10247.   See  the Linux  Ethernet HOWTO  for a  more  complete discussion  of
  10248. Linux Ethernet hardware compatibility.
  10249.   Linux also supports SLIP, which allows you to use  a modem to access
  10250. the Internet over the phone line.   In this case, you'll need  a modem
  10251. compatible with  your SLIP  server---most  servers require  a  14.4bps
  10252. V.32bis modem.
  10253.  
  10254. 5.3.2 Configuring TCP/IP on your system
  10255.  
  10256. In this section we're  going to discuss  how to configure an  Ethernet
  10257. TCP/IP connection on your system.   Note that this method  should work
  10258. for many  systems, but  certainly not  all.    This discussion  should
  10259. be enough to  get you  on the  right path to  configuring the  network
  10260. parameters of your machine,  but there are  numerous caveats and  fine
  10261. details not  mentioned here.    We  direct you  to  the Linux  Network
  10262. Administrators' Guide and the NET-2-HOWTO for more information.(3)
  10263.   First of all,  we assume that you have  a Linux system that  has the
  10264. TCP/IP software installed.  This includes basic clients such as telnet
  10265. and ftp,  system administration commands  such as  ifconfig and  route
  10266. (usually found in /etc),  and networking configuration files (such  as
  10267. /etc/hosts).  The  other Linux-related networking documents  described
  10268. above explain how to go about installing the Linux networking software
  10269. if you do not have it already.
  10270.   We also  assume that your  kernel has  been configured and  compiled
  10271. with TCP/IP  support enabled.    See Section  4.7  for information  on
  10272. compiling your kernel.  To enable networking, you  must answer ``yes''
  10273. to the appropriate questions during the make config step,  and rebuild
  10274. the kernel.
  10275.   Once this has been  done, you must modify a number  of configuration
  10276. files used by NET-2.   For the most  part this is a simple  procedure.
  10277. Unfortunately,  however,  there is  wide  disagreement  between  Linux
  10278.  
  10279. ----------------------------
  10280.  3. Some of this information is adapted from the NET-2-HOWTO  by Terry
  10281. Dawson and Matt Welsh.
  10282. 5.3.   Networking with TCP/IP                                      187
  10283. _______________________________________________________________________
  10284.  
  10285. distributions as to where the  various TCP/IP configuration files  and
  10286. support programs should go.   Much of the  time, they can be found  in
  10287. /etc, but in other cases may  be found in /usr/etc, /usr/etc/inet,  or
  10288. other bizarre locations.   In the  worst case you'll  have to use  the
  10289. find command to locate the files on  your system.  Also note  that not
  10290. all distributions keep the NET-2  configuration files and software  in
  10291. the same location---they may be spread across several directories.
  10292.   The  following information  applies  primarily to  Ethernet  connec-
  10293. tions.    If  you're  planning  to use  SLIP,  read  this  section  to
  10294. understand the concepts, and follow the SLIP-specific  instructions in
  10295. the following section.
  10296.  
  10297. 5.3.2.1 Your network configuration
  10298.  
  10299. Before you can configure TCP/IP,  you need to determine the  following
  10300. information about  your network  setup.   In  most cases,  your  local
  10301. network administrator can provide you with this information.
  10302.  
  10303.  o  IP address.  This is the unique machine  address in dotted-decimal
  10304.     format.  An example is  128.253.153.54.  Your network  admins will
  10305.     provide you with this number.
  10306.  
  10307.     If you're  only  configuring loopback  mode (i.e.    no  SLIP,  no
  10308.     ethernet card, just TCP/IP  connections to your own machine)  then
  10309.     your IP address is 127.0.0.1.
  10310.  
  10311.  o  Your  network  mask  (``netmask'').     This  is  a  dotted  quad,
  10312.     similar to the IP address,  which determines which portion  of the
  10313.     IP address  specifies the  subnetwork  number, and  which  portion
  10314.     specifies the host  on that  subnet.   (If you're  shaky on  these
  10315.     TCP/IP networking  terms,  we  suggest reading  some  introductory
  10316.     material on  network  administration.)    The  network mask  is  a
  10317.     pattern of  bits, which  when overlayed  onto an  address on  your
  10318.     network, will tell you which subnet  that address lives on.   This
  10319.     is very important for routing, and if you find, for  example, that
  10320.     you can happily talk  to people outside  your network, but not  to
  10321.     some people within your network,  there is a good chance  that you
  10322.     have an incorrect mask specified.
  10323.  
  10324.     Your network administrators will have chosen the netmask  when the
  10325.     network was designed, and therefore they should be able  to supply
  10326.     you with the  correct mask  to use.    Most networks  are class  C
  10327.     subnetworks which use 255.255.255.0 as their netmask.  Other Class
  10328.     B networks use  255.255.0.0.   The NET-2  code will  automatically
  10329.     select a mask that  assumes no subnetting as  a default if you  do
  10330.     not specify one.
  10331.  
  10332.     This applies as  well to the  loopback port.   Since the  loopback
  10333.     port's address is always 127.0.0.1,  the netmask for this  port is
  10334.     always 255.0.0.0.  You can either specify this  explicitly or rely
  10335. 5.3.   Networking with TCP/IP                                      188
  10336. _______________________________________________________________________
  10337.  
  10338.     on the default mask.
  10339.  
  10340.  o  Your  network  address.      This  is   your  IP  address   masked
  10341.     bitwise-ANDed the  netmask.    For  example,  if your  netmask  is
  10342.     255.255.255.0, and your IP address is 128.253.154.32, your network
  10343.     address is 128.253.154.0.    With a netmask  of 255.255.0.0,  this
  10344.     would be 128.253.0.0.
  10345.  
  10346.     If you're only using loopback, you don't have a network address.
  10347.  
  10348.  o  Your broadcast  address.     The  broadcast  address  is  used  to
  10349.     broadcast packets to every machine on your subnet.   Therefore, if
  10350.     the host number of  machines on your subnet  is given by the  last
  10351.     byte of  the IP  address (netmask  255.255.255.0), your  broadcast
  10352.     address will be your network address ORed with 0.0.0.255.
  10353.  
  10354.     For  example,   if  your   IP  address  is   128.253.154.32,   and
  10355.     your  netmask  is   255.255.255.0,   your  broadcast  address   is
  10356.     128.253.154.255.
  10357.  
  10358.     Note that for historical reasons,  some networks are setup  to use
  10359.     the network  address as  the broadcast  address, if  you have  any
  10360.     doubt, check with  your network administrators.   (In many  cases,
  10361.     it will suffice  to duplicate the  network configuration of  other
  10362.     machines on  your subnet,  substituting your  own IP  address,  of
  10363.     course.)
  10364.  
  10365.     If you're only using loopback, you don't have a broadcast address.
  10366.  
  10367.  o  Your gateway address.   This is the  address of the machine  which
  10368.     is your  ``gateway'' to  the outside  world (i.e.    machines  not
  10369.     on your subnet).    In many cases  the gateway  machine has an  IP
  10370.     address identical to yours but with a ``.1'' as  its host address;
  10371.     e.g., if your IP address is 128.253.154.32, your gateway  might be
  10372.     128.253.154.1.  Your network  admins will provide you with  the IP
  10373.     address of your gateway.
  10374.  
  10375.     In fact, you may  have multiple gateways.   A gateway is simply  a
  10376.     machine that lives  on two  different networks  (has IP  addresses
  10377.     on different  subnets), and  routes packets  between them.    Many
  10378.     networks have  a  single gateway  to  ``the outside  world''  (the
  10379.     network directly adjacent to your own), but in some cases you will
  10380.     have multiple gateways---one for each adjacent network.
  10381.  
  10382.     If you're only using loopback,  you don't have a  gateway address.
  10383.     The same is true if your network is isolated from all others.
  10384.  
  10385.  o  Your nameserver address.   Most  machines on the  net have a  name
  10386.     server which  translates hostnames  into  IP addresses  for  them.
  10387.     Your network admins will tell you the address of your name server.
  10388. 5.3.   Networking with TCP/IP                                      189
  10389. _______________________________________________________________________
  10390.  
  10391.     You can also run  a server on your  own machine by running  named,
  10392.     in which case  the nameserver address  is 127.0.0.1.   Unless  you
  10393.     absolutely must run your own name server, we suggest using the one
  10394.     provided to you on the network  (if any).  Configuration  of named
  10395.     is another issue altogether; our priority at this point  is to get
  10396.     you talking to  the network.   You can  deal with name  resolution
  10397.     issues later.
  10398.  
  10399.     If you're  only  using  loopback,  you  don't  have  a  nameserver
  10400.     address.
  10401.  
  10402.   SLIP  users:    You  may  or  may  not  require  any  of  the  above
  10403. information, except for a nameserver  address.  When using  SLIP, your
  10404. IP address  is usually  determined in  one of  two ways:   Either  (a)
  10405. you have a  ``static'' IP address,  which is the  same every time  you
  10406. connect to the  network, or  (b) you  have a  ``dynamic'' IP  address,
  10407. which is allocated from a pool available addresses when you connect to
  10408. the server.   In the following section  on SLIP configuration this  is
  10409. covered in more detail.
  10410.   NET-2  supports full  routing,  multiple routes,  subnetworking  (at
  10411. this stage  on byte  boundaries only),  the  whole nine  yards.    The
  10412. above describes most basic TCP/IP configurations.  Yours may  be quite
  10413. different:  when in doubt, consult your local network  gurus and check
  10414. out the man pages for route and ifconfig.  Configuring TCP/IP networks
  10415. is very much beyond the scope of this book; the above should be enough
  10416. to get most people started.
  10417.  
  10418. 5.3.2.2 The networking rc files
  10419.  
  10420. rc files are  systemwide configuration scripts  executed at boot  time
  10421. by init,  which start  up all  of the  basic system  daemons (such  as
  10422. sendmail, cron,  etc.)    and  configure things  such as  the  network
  10423. parameters, system hostname, and so on.  rc files are usually found in
  10424. the directory /etc/rc.d but on other systems may be in /etc.
  10425.   Here,  we're  going to  describe  the  rc files  used  to  configure
  10426. TCP/IP. There are two of  them:  rc.inet1 and  rc.inet2.  rc.inet1  is
  10427. used to configure the basic  network parameters (such as IP  addresses
  10428. and routing  information) and  rc.inet2 fires  up  the TCP/IP  daemons
  10429. (telnetd, ftpd, and so forth).
  10430.   Many  systems combine  these  two  files into  one,  usually  called
  10431. rc.inet or rc.net.  The  names given to your rc files  doesn't matter,
  10432. as long as they perform the correct functions and are executed at boot
  10433. time by init.  To ensure  this, you may need to edit  /etc/inittab and
  10434. uncomment lines to execute the appropriate  rc file(s).  In  the worst
  10435. case you will  have to  create the  rc.inet1 and  rc.inet2 files  from
  10436. scratch and add entries for them to /etc/inittab.
  10437.   As  we  said,  rc.inet1  configures  the  basic  network  interface.
  10438. This includes  your IP  and  network address,  and  the routing  table
  10439. information for your network.   The routing  tables are used to  route
  10440. outgoing (and incoming) network datagrams to other machines.   On most
  10441. 5.3.  Networking with TCP/IP                                       190
  10442. _______________________________________________________________________
  10443.  
  10444. simple configurations, you have three routes:  One for sending packets
  10445. to your own machine, another for sending packets to  other machines on
  10446. your network, and another for  sending packets to machines  outside of
  10447. your network (through the gateway machine).  Two programs  are used to
  10448. configure these parameters:   ifconfig and route.   Both of these  are
  10449. usually found in /etc.
  10450.   ifconfig is used  for configuring the network device  interface with
  10451. the parameters that it requires to  function, such as the  IP address,
  10452. network mask, broadcast address and the like.  route is used to create
  10453. and modify entries in the routing table.
  10454.   For  most configurations,  an  rc.inet1  file  that looks  like  the
  10455. following should work.   You will,  of course, have  to edit this  for
  10456. your own system.    Do not  use the  sample IP  and network  addresses
  10457. listed here for your own system; they correspond to  an actual machine
  10458. on the Internet.
  10459.  
  10460.   #!/bin/sh
  10461.   # This is /etc/rc.d/rc.inet1 -- Configure the TCP/IP interfaces
  10462.  
  10463.   # First, configure the loopback device
  10464.  
  10465.   HOSTNAME=`hostname`
  10466.  
  10467.   /etc/ifconfig lo 127.0.0.1 # uses default netmask 255.0.0.0
  10468.   /etc/route add 127.0.0.1 # a route to point to the loopback device
  10469.  
  10470.   # Next, configure the ethernet device. If you're only  using 
  10471.   # loopback or SLIP, comment out the rest of these lines.
  10472.  
  10473.   # Edit for your setup.
  10474.   IPADDR="128.253.154.32"     # REPLACE with YOUR IP address
  10475.   NETMASK="255.255.255.0"     # REPLACE with YOUR netmask
  10476.   NETWORK="128.253.154.0"     # REPLACE  with  YOUR  network address
  10477.   BROADCAST="128.253.154.255" # REPLACE with YOUR  broadcast address,
  10478.                               # if you have one. If not, leave blank
  10479.                               # and edit below.
  10480.   GATEWAY="128.253.154.1"     # REPLACE with  YOUR  gateway address!
  10481.  
  10482.   /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
  10483.  
  10484.   # If you don't have a broadcast address, change the above line to:
  10485.   # /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK}
  10486.  
  10487.   /etc/route add ${NETWORK}
  10488. 5.3.  Networking with TCP/IP                                       191
  10489. _______________________________________________________________________
  10490.  
  10491.  
  10492.   # The following is only necessary if you have a gateway; that is,
  10493.   # your network is connected to the outside world.
  10494.   /etc/route add default gw ${GATEWAY} metric 1
  10495.  
  10496.   # End of Ethernet Configuration
  10497.  
  10498.   Again, you may have  to tweak this file somewhat to get it  to work.
  10499. The above  should be  sufficient for  the majority  of simple  network
  10500. configurations, but certainly not all.
  10501.   rc.inet2 starts up  various servers used by  the TCP/IP suite.   The
  10502. most important of these is  inetd.  inetd  sits in the background  and
  10503. listens to various  network ports.   When  a machine  tries to make  a
  10504. connection to a certain port (for example, the incoming  telnet port),
  10505. inetd forks off a copy of the appropriate daemon for that port (in the
  10506. case of the telnet  port, inetd starts in.telnetd).   This is  simpler
  10507. than running  many  separate,  standalone  daemons  (e.g.,  individual
  10508. copies of telnetd, ftpd, and  so forth)---inetd starts up  the daemons
  10509. only when they are needed.
  10510.   syslogd is the  system logging daemon---it accumulates log  messages
  10511. from various  applications and  stores them  into log  files based  on
  10512. the configuration  information  in /etc/syslogd.conf.    routed  is  a
  10513. server used to maintain dynamic routing information.  When your system
  10514. attempts to send packets to another network, it may require additional
  10515. routing table  entries in  order  to do  so.    routed takes  care  of
  10516. manipulating the routing table without the need for user intervention.
  10517.   Our example  rc.inet2, below,  only starts  up the  bare minimum  of
  10518. servers.  There are many other servers as well---many of which have to
  10519. do with NFS configuration.   When attempting  to setup TCP/IP on  your
  10520. system, it's usually  best to start with  a minimal configuration  and
  10521. add more complex pieces (such as NFS) when you have things working.
  10522.   Note that  in the  below file,  we assume  that all  of the  network
  10523. daemons are  held  in  /etc.    As  usual,  edit  this  for  your  own
  10524. configuration.
  10525.  
  10526.     #! /bin/sh
  10527.     # Sample /etc/rc.d/rc.inet2
  10528.  
  10529.     # Start syslogd
  10530.     if [ -f /etc/syslogd ]
  10531.     then
  10532.           /etc/syslogd
  10533.     fi
  10534.  
  10535.     # Start inetd
  10536.     if [ -f /etc/inetd ]
  10537.     then
  10538.           /etc/inetd
  10539.     fi
  10540. 5.3.   Networking with TCP/IP                                      192
  10541. _______________________________________________________________________
  10542.  
  10543.  
  10544.     # Start routed
  10545.     if [ -f /etc/routed ]
  10546.     then
  10547.           /etc/routed -q
  10548.     fi
  10549.  
  10550.     # Done!
  10551.  
  10552.   Among the various additional  servers that you may want to  start in
  10553. rc.inet2 is named.   named  is a name  server---it is responsible  for
  10554. translating (local) IP  addresses to names,  and vice versa.   If  you
  10555. don't have a nameserver elsewhere on  the network, or want  to provide
  10556. local machine  names to  other  machines in  your  domain, it  may  be
  10557. necessary to run named.  (For most configurations it is not necessary,
  10558. however.)    named  configuration  is somewhat  complex  and  requires
  10559. planning; we refer interested readers to a good book on TCP/IP network
  10560. administration.
  10561.  
  10562. 5.3.2.3 /etc/hosts
  10563.  
  10564. /etc/hosts contains  a list  of IP  addresses and  the hostnames  that
  10565. they correspond  to.   In  general, /etc/hosts  only contains  entries
  10566. for your  local  machine,  and perhaps  other  ``important''  machines
  10567. (such as your  nameserver or gateway).   Your  local name server  will
  10568. provide address-to-name mappings  for other  machines on the  network,
  10569. transparently.
  10570.   For  example,  if your  machine  is  loomer.vpizza.com with  the  IP
  10571. address 128.253.154.32, your /etc/hosts would look like:
  10572.  
  10573.     127.0.0.1               localhost
  10574.     128.253.154.32          loomer.vpizza.com loomer
  10575.  
  10576. If you're only using loopback,  the only line in /etc/hosts  should be
  10577. for 127.0.0.1, with both localhost and your hostname after it.
  10578.  
  10579. 5.3.2.4 /etc/networks
  10580.  
  10581. The /etc/networks file lists the names and addresses of your  own, and
  10582. other, networks.  It is used  by the route command, and allows  you to
  10583. specify a network by name, should you so desire.
  10584.   Every network  you wish to  add a route to  using the route  command
  10585. (generally called from  rc.inet1---see above)  must have  an entry  in
  10586. /etc/networks.
  10587.   As an example,
  10588.  
  10589.     default 0.0.0.0 # default route    - mandatory
  10590.     loopnet 127.0.0.0 # loopback network - mandatory
  10591.     mynet 128.253.154.0 # Modify for your own network address
  10592. 5.3.   Networking with TCP/IP                                      193
  10593. _______________________________________________________________________
  10594.  
  10595. 5.3.2.5 /etc/host.conf
  10596.  
  10597. This file is used to  specify how your system will  resolve hostnames.
  10598. It should contain the two lines:
  10599.  
  10600.     order hosts,bind
  10601.     multi on
  10602.  
  10603. These lines tell the resolve  libraries to first check the  /etc/hosts
  10604. file for any names to lookup,  and then ask the nameserver (if  one is
  10605. present).  The  multi entry allows you  to have multiple IP  addresses
  10606. for a given machine name in /etc/hosts.
  10607.  
  10608. 5.3.2.6 /etc/resolv.conf
  10609.  
  10610. This file  configures the  name resolver,  specifying  the address  of
  10611. your name server  (if any)  and your domain  name.   Your domain  name
  10612. is your fully-qualified  hostname (if you're  a registered machine  on
  10613. the Internet, for example), with the  hostname chopped off.   That is,
  10614. if your full hostname is  loomer.vpizza.com, your domain name  is just
  10615. vpizza.com.
  10616.   For  example,  if your  machine  is goober.norelco.com,  and  has  a
  10617. nameserver at the address  128.253.154.5, your /etc/resolv.conf  would
  10618. look like:
  10619.  
  10620.     domain      norelco.com
  10621.     nameserver  127.253.154.5
  10622.  
  10623. You can specify more than one nameserver---each must have a nameserver
  10624. line of its own in resolv.conf.
  10625.  
  10626. 5.3.2.7 Setting your hostname
  10627.  
  10628. You should set your system hostname  with the hostname command.   This
  10629. is usually called  from /etc/rc or  /etc/rc.local; simply search  your
  10630. system rc files to  determine where it  is invoked.   For example,  if
  10631. your (full)  hostname is  loomer.vpizza.com, edit  the appropriate  rc
  10632. file to execute the command:
  10633.  
  10634.     /bin/hostname loomer.vpizza.com
  10635.  
  10636. Note that the  hostname executable may  not be found  in /bin on  your
  10637. system.
  10638.  
  10639. 5.3.2.8 Trying it out
  10640.  
  10641. Once you have all of these files set up, you should be  able to reboot
  10642. your new kernel and attempt to use the network.  There are many places
  10643. where things can  go wrong,  so it's  a good idea  to test  individual
  10644. aspects of the network configuration  (e.g., it's probably not  a good
  10645. 5.3.   Networking with TCP/IP                                      194
  10646. _______________________________________________________________________
  10647.  
  10648. idea to test  your network configuration  by firing  up Mosaic over  a
  10649. network-based X connection).
  10650.   You can  use the  netstat command  to display  your routing  tables;
  10651. this is usually the source of the most trouble.  The  netstat man page
  10652. describes the exact syntax  of this command  in detail.   In order  to
  10653. test network connectivity,  we suggest using a  client such as  telnet
  10654. to connect  to machines  both on  your local  subnetwork and  external
  10655. networks.  This will  help to narrow down  the source of the  problem.
  10656. (For example, if you're unable  to connect to local machines,  but can
  10657. connect to machines  on other networks,  more than  likely there is  a
  10658. problem with your netmask and  routing table configuration).   You can
  10659. also invoke the  route command  directly (as  root) to  play with  the
  10660. entries in your routing table.
  10661.   You  should  also   test  network  connectivity  by  specifying   IP
  10662. addresses directly, instead of  hostnames.   For example, if you  have
  10663. problems with the command
  10664.  
  10665.     $ telnet shoop.vpizza.com
  10666.  
  10667. the cause may be  incorrect nameserver configuration.   Try using  the
  10668. actual IP address of the machine in question; if that  works, then you
  10669. know that your basic network setup is (more than likely)  correct, and
  10670. the problem lies in your specification of the name server address.
  10671.   Debugging network  configurations can  be a difficult  task, and  we
  10672. can't begin  to  cover it  here.    If  you  are  unable to  get  help
  10673. from a  local  guru we  strongly  suggest  reading the  Linux  Network
  10674. Administrators' Guide from the LDP.
  10675.  
  10676. 5.3.3 SLIP Configuration
  10677.  
  10678. SLIP (Serial Line Internet Protocol)  allows you to use TCP/IP  over a
  10679. serial line, be that a  phone line, with a  dialup modem, or a  leased
  10680. asynchronous line of some sort.   Of course,  to use SLIP you'll  need
  10681. access to a dial-in SLIP server  in your area.  Many  universities and
  10682. businesses provide SLIP access for a modest fee.
  10683.   There  are  two  major  SLIP-related  programs  available---dip  and
  10684. slattach.    Both  of these  programs  are  used to  initiate  a  SLIP
  10685. connection over a serial device.  It is necessary to use  one of these
  10686. programs in order to enable SLIP---it will not suffice to  dial up the
  10687. SLIP server (with a communications  program such as kermit) and  issue
  10688. ifconfig and route commands.  This is because dip and slattach issue a
  10689. special ioctl() system call to  seize control of the serial  device to
  10690. be used as a SLIP interface.
  10691.   dip can  be  used to  dial up  a SLIP  server,  do some  handshaking
  10692. to login to  the server  (exchanging your username  and password,  for
  10693. example) and then  initate the  SLIP connection over  the open  serial
  10694. line.   slattach,  on  the other  hand, does  very  little other  than
  10695. grab the serial device  for use by  SLIP. It is  useful if you have  a
  10696. permanent line to your SLIP server and no modem dialup  or handshaking
  10697. is necessary  to initiate  the connection.    Most  dialup SLIP  users
  10698. 5.3.   Networking with TCP/IP                                      195
  10699. _______________________________________________________________________
  10700.  
  10701. should use dip, on the other hand.
  10702.   dip can  also  be used  to configure  your Linux  system  as a  SLIP
  10703. server, where other machines can dial into your own and connect to the
  10704. network through a secondary Ethernet connection on your machine.   See
  10705. the documentation and man pages  for dip for more information  on this
  10706. procedure.
  10707.   SLIP is quite unlike  Ethernet, in that there are only  two machines
  10708. on the ``network''---the SLIP host  (that's you) and the SLIP  server.
  10709. For this reason,  SLIP is  often referred to  as a  ``point-to-point''
  10710. connection.   A generalization of  this idea, known  as PPP (Point  to
  10711. Point Protocol) has also been implemented for Linux.
  10712.   When you  initiate a connection  to a SLIP  server, the SLIP  server
  10713. will give you  an IP address  based on (usually)  one of two  methods.
  10714. Some SLIP  servers allocate  ``static'' IP  addresses---in which  case
  10715. your IP address will be the same every time you connect to the server.
  10716. However, many  SLIP  servers  allocate IP  addresses  dynamically---in
  10717. which case you receive a  different IP address each time  you connect.
  10718. In general,  the SLIP  server will  print the  values of  your IP  and
  10719. gateway addresses when you connect.   dip is capable of  reading these
  10720. values from the output of the SLIP server login session and using them
  10721. to configure the SLIP device.
  10722.   Essentially, configuring a SLIP connection is  just like configuring
  10723. for loopback or ethernet.   The main differences are  discussed below.
  10724. Read the previous section on  configuring the basic TCP/IP files,  and
  10725. apply the changes described below.
  10726.  
  10727. 5.3.3.1 Static IP address SLIP connections using dip
  10728.  
  10729. If you are  using a  static-allocation SLIP  server, you  may want  to
  10730. include entries  for  your  IP  address and  hostname  in  /etc/hosts.
  10731. Also, configure these  files listed in the  above section:   rc.inet2,
  10732. host.conf, and resolv.conf.
  10733.   Also, configure  rc.inet1, as  described above.   However, you  only
  10734. want to execute ifconfig and  route commands for the loopback  device.
  10735. If you use  dip to connect  to the  SLIP server,  it will execute  the
  10736. appropriate ifconfig and route commands  for the SLIP device for  you.
  10737. (If you're using slattach, on the other hand, you will need to include
  10738. ifconfig/route commands in rc.inet1 for the SLIP device---see below.)
  10739.   dip should configure your routing tables appropriately  for the SLIP
  10740. connection when you connect.   In some cases, however,  dip's behavior
  10741. may not be  correct for  your configuration,  and you'll  have to  run
  10742. ifconfig or route commands by hand after connecting to the server with
  10743. dip (this is  most easily done  from within a  shell script that  runs
  10744. dip and immediately executes the appropriate  configuration commands).
  10745. Your gateway is, in most cases, the  address of the SLIP server.   You
  10746. may know this  address before  hand, or  the gateway  address will  be
  10747. printed by the SLIP  server when you  connect.   Your dip chat  script
  10748. (described below) can obtain this information from the SLIP server.
  10749.   ifconfig  may  require use  of  the  pointopoint  argument,  if  dip
  10750. doesn't configure  the interface  correctly.    For example,  if  your
  10751. 5.3.   Networking with TCP/IP                                      196
  10752. _______________________________________________________________________
  10753.  
  10754. SLIP  server  address  is  128.253.154.2,  and  your   IP  address  is
  10755. 128.253.154.32, you may need to run the command
  10756.  
  10757.     ifconfig sl0 128.253.154.32 pointopoint 128.253.154.2
  10758.  
  10759. as root, after connecting with dip.   The man pages for  ifconfig will
  10760. come in handy.
  10761.   Note  that SLIP  device  names  used  with the  ifconfig  and  route
  10762. commands are sl0, sl1 and so on  (as opposed to eth0, eth1, etc.   for
  10763. Ethernet devices).
  10764.   In Section 5.3.4, below, we explain how to  configure dip to connect
  10765. to the SLIP server.
  10766.  
  10767. 5.3.3.2 Static IP address SLIP connections using slattach
  10768.  
  10769. If you  have a  leased line  or cable  running directly  to your  SLIP
  10770. server, then there  is no need  to use dip  to initiate a  connection.
  10771. slattach can be used to configure the SLIP device instead.
  10772.   In this  case, your  /etc/rc.inet1 file should  look something  like
  10773. the following:
  10774.  
  10775.     #!/bin/sh
  10776.     IPADDR="128.253.154.32"         # Replace with your IP address
  10777.     REMADDR="128.253.154.2" # Replace with your SLIP server address
  10778.  
  10779.     # Modify the following for the appropriate serial device for
  10780.     # the SLIP connection:
  10781.     slattach -p cslip -s 19200 /dev/ttyS0
  10782.     /etc/ifconfig sl0 $IPADDR pointopoint $REMADDR up
  10783.     /etc/route add default gw $REMADDR
  10784.  
  10785.   slattach  allocates the  first unallocated  SLIP device  (sl0,  sl1,
  10786. etc.)  to the serial line specified.
  10787.   Note that the  first parameter to slattach  is the SLIP protocol  to
  10788. use.  At present  the only valid values are  slip and cslip.   slip is
  10789. regular SLIP, as  you would expect,  and cslip  is SLIP with  datagram
  10790. header compression.  In most  cases you should use cslip;  however, if
  10791. you seem to be having problems with this, try slip.
  10792.   If you have more than one SLIP interface then  you will have routing
  10793. considerations to make.  You  will have to decide what routes  to add,
  10794. and those decisions can only be made on the basis of the actual layout
  10795. of your network connections.  A book on TCP/IP  network configuration,
  10796. as well as the man pages to route, will be of use.
  10797.  
  10798. 5.3.3.3 Dynamic IP address SLIP connections using dip
  10799.  
  10800. If your  SLIP server  allocates an  IP address  dynamically, then  you
  10801. certainly don't know  your address in  advance---therefore, you  can't
  10802. include an entry for it in /etc/hosts.  (You should,  however, include
  10803. 5.3.  Networking with TCP/IP                                       197
  10804. _______________________________________________________________________
  10805.  
  10806. an entry for your host with the loopback address, 127.0.0.1.)
  10807.   Many SLIP  servers print your  IP address (as  well as the  server's
  10808. address) when  you connect.    For example,  one type  of SLIP  server
  10809. prints a string such as,
  10810.  
  10811.     Your IP address is 128.253.154.44.
  10812.     Server address is 128.253.154.2.
  10813.  
  10814. dip can capture these  numbers from the output  of the server and  use
  10815. them to configure the SLIP device.
  10816.   See Section  5.3.3.1,  above, for  information  on configuring  your
  10817. various TCP/IP  files for  use with  SLIP. Below,  we  explain how  to
  10818. configure dip to connect to the SLIP server.
  10819.  
  10820. 5.3.4 Using dip
  10821.  
  10822. dip can simplify the process of  connecting to a SLIP server,  logging
  10823. in, and configuring the  SLIP device.   Unless you have a leased  line
  10824. running to your SLIP server, dip is the way to go.
  10825.   To use dip,  you'll need to write  a ``chat script'' which  contains
  10826. a list of commands used to  communicate with the SLIP server  at login
  10827. time.  These commands can automatically send your username/password to
  10828. the server, as  well as get  information on your  IP address from  the
  10829. server.
  10830.   Here is  an  example dip  chat script,  for  use with  a dynamic  IP
  10831. address server.     For static  servers,  you  will need  to  set  the
  10832. variables $local and $remote  to the values  of your local IP  address
  10833. and server IP address,  respectively, at the top  of the script.   See
  10834. the dip man page for details.
  10835.  
  10836.     main:
  10837.       # Set Maximum Transfer Unit. This is the maximum size of packets
  10838.       # transmitted on the SLIP device. Many SLIP servers use either
  10839.       # 1500 or 1006; check with your network admins when in doubt.
  10840.       get $mtu 1500
  10841.  
  10842.       # Make the SLIP route the default route on your system.
  10843.       default
  10844.  
  10845.       # Set the desired serial port and speed.
  10846.       port cua03
  10847.       speed 38400
  10848.  
  10849.       # Reset the modem and terminal line. If this causes trouble
  10850.       # for you, comment it out.
  10851.       reset
  10852.  
  10853.       # Prepare for dialing. Replace the following with your
  10854. 5.3.  Networking with TCP/IP                                       198
  10855. _______________________________________________________________________
  10856.  
  10857.       # modem initialization string.
  10858.       send ATT&C1&D2\\N3&Q5%M3%C1N1W1L1S48=7\r
  10859.       wait OK 2
  10860.       if $errlvl != 0 goto error
  10861.       # Dial the SLIP server
  10862.       dial 2546000
  10863.       if $errlvl != 0 goto error
  10864.       wait CONNECT 60
  10865.       if $errlvl != 0 goto error
  10866.  
  10867.       # We are connected.  Login to the system.
  10868.     login:
  10869.       sleep 3
  10870.       send \r\n\r\n
  10871.       # Wait for the login prompt
  10872.       wait login: 10
  10873.       if $errlvl != 0 goto error
  10874.  
  10875.       # Send your username
  10876.       send USERNAME\n
  10877.  
  10878.       # Wait for password prompt
  10879.       wait ord: 5
  10880.       if $errlvl != 0 goto error
  10881.  
  10882.       # Send password.
  10883.       send PASSWORD\n
  10884.  
  10885.       # Wait for SLIP server ready prompt
  10886.       wait annex: 30
  10887.       if $errlvl != 0 goto error
  10888.  
  10889.       # Send commands to SLIP server to initate connection.
  10890.       send slip\n
  10891.       wait Annex 30
  10892.  
  10893.       # Get the remote IP address from the SLIP server. The
  10894.       # `get...remote' command reads text in the form xxx.xxx.xxx.xxx,
  10895.       # and assigns it to the variable given as the second argument
  10896.       # (here, $remote).
  10897.       get $remote remote
  10898.       if $errlvl != 0 goto error
  10899.       wait Your 30
  10900.  
  10901.        # Get local IP address from SLIP server, assign to variable
  10902.        # $local.
  10903.       get $local remote
  10904.       if $errlvl != 0 goto error
  10905.  
  10906.       # Fire up the SLIP connection
  10907. 5.4.   Networking with UUCP                                        199
  10908. _______________________________________________________________________
  10909.  
  10910.     done:
  10911.       print CONNECTED to $remote at $rmtip
  10912.       print GATEWAY address $rmtip
  10913.       print LOCAL address $local
  10914.       mode SLIP
  10915.       goto exit
  10916.     error:
  10917.       print SLIP to $remote failed.
  10918.  
  10919.     exit:
  10920.  
  10921.   dip automatically executes ifconfig and route commands  based on the
  10922. values of the variables $local and $remote.  Here, those variables are
  10923. assigned using the get... remote command, which obtains text  from the
  10924. SLIP server and assigns it to the named variable.
  10925.   If the  ifconfig  and route  commands that  dip runs  for you  don't
  10926. work, you can either run the correct commands in a  shell script after
  10927. executing dip, or modify the source for dip itself.   Running dip with
  10928. the -v option will print debugging information while the connection is
  10929. being set up, which should help you to determine where things might be
  10930. going awry.
  10931.   Now, in order to run  dip and open the SLIP connection, you  can use
  10932. a command such as:
  10933.  
  10934.     /etc/dip/dip -v /etc/dip/mychat 2>&1
  10935.  
  10936. Where the various  dip files,  and the chat  script (mychat.dip),  are
  10937. stored in /etc/dip.
  10938.   The above discussion  should be enough to  get you well on your  way
  10939. to talking to  the network,  either via  Ethernet or  SLIP. Again,  we
  10940. strongly suggest looking into a book on TCP/IP  network configuration,
  10941. especially if  your network  has any  special routing  considerations,
  10942. other than those mentioned here.
  10943.  
  10944.  
  10945. 5.4 Networking with UUCP
  10946.  
  10947. UUCP (UNIX-to-UNIX  Copy)  is  an  older mechanism  used  to  transfer
  10948. information between UNIX systems.  Using UUCP, UNIX systems  dial each
  10949. other up (using a  modem) and transfer  mail messages, news  articles,
  10950. files, and so on.   If you don't have  TCP/IP or SLIP access,  you can
  10951. use UUCP to communicate  with the world.   Most  of the mail and  news
  10952. software (see Sections  5.5 and  5.6) can  be configured  to use  UUCP
  10953. to transfer information to other  machines.  In  fact, if there is  an
  10954. Internet site nearby, you  can arrange to  have Internet mail sent  to
  10955. your Linux machine via UUCP from that site.
  10956.   The   Linux   Network  Administrator's   Guide   contains   complete
  10957. information on configuring  and using  UUCP under  Linux.   Also,  the
  10958. Linux UUCP HOWTO,  available via  anonymous FTP from  sunsite.unc.edu,
  10959. should be of  help.   Another  source of  information on  UUCP is  the
  10960. book Managing UUCP and USENET, by Tim O'Reilly and Grace Todino.   See
  10961. 5.5.   Electronic Mail                                             200
  10962. _______________________________________________________________________
  10963.  
  10964. Appendix A for more information.
  10965.  
  10966.  
  10967. 5.5 Electronic Mail
  10968.  
  10969. Like most UNIX systems, Linux  provides a number of  software packages
  10970. for using electronic mail.  E-mail on your system can  either be local
  10971. (that is,  you only mail  other users  on your  system), or  networked
  10972. (that is,  you  mail, using  either  TCP/IP or  UUCP, users  on  other
  10973. machines on  a network).    E-mail software  usually  consists of  two
  10974. parts:   a mailer  and a  transport.   The  mailer  is the  user-level
  10975. software which is used to  actually compose and read e-mail  messages.
  10976. Popular mailers include elm and mailx.  The transport is the low-level
  10977. software which  actually takes  care of  delivering the  mail,  either
  10978. locally or remotely.  The user never sees the transport software; they
  10979. only interact with the mailer.  However, as  the system administrator,
  10980. it is  important  to  understand  the concepts  behind  the  transport
  10981. software and how to configure it.
  10982.   The  most popular  transport software  for  Linux is  Smail.    This
  10983. software is easy  to configure,  and is  able to send  both local  and
  10984. remote TCP/IP and UUCP e-mail.   The more powerful  sendmail transport
  10985. is used on  most UNIX  systems,  however, because  of its  complicated
  10986. setup mechanism, many Linux systems don't use it.
  10987.   The Linux Mail  HOWTO gives more  information on the available  mail
  10988. software for Linux and  how to configure  it on your  system.  If  you
  10989. plan to send mail remotely, you'll need to understand either TCP/IP or
  10990. UUCP, depending on how your machine is networked (see Sections 5.3 and
  10991. 5.4).  The UUCP and TCP/IP documents listed in Appendix A should be of
  10992. help there.
  10993.   Most of the Linux  mail software can be retrieved via  anonymous FTP
  10994. from sunsite.unc.edu in the directory /pub/Linux/system/Mail.
  10995.  
  10996. 5.6 News and USENET
  10997.  
  10998. Linux also provides  a number  of facilities  for managing  electronic
  10999. news.  You may  choose to set up a  local news server on  your system,
  11000. which will allow users to post ``articles'' to  various ``newsgroups''
  11001. on the  system... a  lively form  of  discussion.    However,  if  you
  11002. have access to  a TCP/IP or  UUCP network,  then you  will be able  to
  11003. participate in USENET---a worldwide network news service.
  11004.   There  are two  parts  to the  news  software---the server  and  the
  11005. client.  The news server is the software which controls the newsgroups
  11006. and handles delivering  articles to other  machines (if  you are on  a
  11007. network).   The  news client,  or newsreader,  is  the software  which
  11008. connects to the server to allow users to read and post news.
  11009.   There  are  several  forms of  news  servers  available  for  Linux.
  11010. They all  follow  the  same basic  protocols  and  design.    The  two
  11011. primary versions are ``C News''  and ``INN''. There are many  types of
  11012. newsreaders, as well, such as rn and tin.  The choice of newsreader is
  11013. more or less a  matter of taste;  all newsreaders should work  equally
  11014. 5.6.   News and USENET                                             201
  11015. _______________________________________________________________________
  11016.  
  11017. well with different  versions of the  server software.   That is,  the
  11018. newsreader is independent of the server software, and vice versa.
  11019.   If you  only want  to run  news  locally (that  is, not  as part  of
  11020. USENET), then you will need to run a server on your system, as well as
  11021. install a newsreader for the  users.  The  news server will store  the
  11022. articles in a  directory such as  /usr/spool/news, and the  newsreader
  11023. will be compiled to look in this directory for news articles.
  11024.   However,  if you  wish  to run  news  over  the network,  there  are
  11025. several options  open  to you.     TCP/IP network-based  news  uses  a
  11026. protocol known as  NNTP (Network  News Transmission Protocol).    NNTP
  11027. allows a  newsreader  to read  news  over  the network,  on  a  remote
  11028. machine.  NNTP also allows news servers to send articles to each other
  11029. over the network---this is  the software upon  which USENET is  based.
  11030. Most businesses and universities have one or more NNTP servers  set up
  11031. to handle all of the USENET news  for that site.  Every  other machine
  11032. at the site runs an NNTP-based  newsreader to read and post  news over
  11033. the network via the NNTP server.  This means that only the NNTP server
  11034. actually stores the news articles on disk.
  11035.   Here are some possible scenarios for news configuration.
  11036.  
  11037.  o  You run news locally.  That is, you have no network connection, or
  11038.     no desire to run news over the network.  In this case, you need to
  11039.     run C News  or INN on  your machine, and  install a newsreader  to
  11040.     read the news locally.
  11041.  
  11042.  o  You have access to a TCP/IP network  and an NNTP server.   If your
  11043.     organization has an NNTP news server set up, you can read and post
  11044.     news from your  Linux machine by  simply installing an  NNTP-based
  11045.     newsreader.  (Most newsreaders available can be configured  to run
  11046.     locally or use NNTP). In this  case, you do not need to  install a
  11047.     news server or store news articles on your system.  The newsreader
  11048.     will take care of reading and  posting news over the network.   Of
  11049.     course, you will need to have TCP/IP configured and have access to
  11050.     the network (see Section 5.3).
  11051.  
  11052.  o  You have access to a TCP/IP network  but have no NNTP server.   In
  11053.     this case, you can run an  NNTP news server on your  Linux system.
  11054.     You can install either  a local or  an NNTP-based newsreader,  and
  11055.     the server will store news articles on your system.   In addition,
  11056.     you can configure the server  to communicate with other  NNTP news
  11057.     servers to transfer news articles.
  11058.  
  11059.  o  You want to  transfer news  using UUCP.  If you  have UUCP  access
  11060.     (see Section 5.4),  you can participate  in USENET as  well.   You
  11061.     will need to  install a  (local) news  server and  a news  reader.
  11062.     In addition,  you will  need to  configure your  UUCP software  to
  11063.     periodically transfer news articles to another nearby UUCP machine
  11064.     (known as your ``news feed'').  UUCP does not use NNTP to transfer
  11065.     news; simply,  UUCP provides  its own  mechanism for  transferring
  11066.     news articles.
  11067. 5.6.   News and USENET                                             202
  11068. _______________________________________________________________________
  11069.  
  11070.   The one  downside of  most news  server and  newsreader software  is
  11071. that it must be compiled by hand.  Most of the news  software does not
  11072. use configuration files; instead, configuration options are determined
  11073. at compile time.
  11074.   Most  of the  ``standard'' news  software  (available via  anonymous
  11075. FTP from ftp.uu.net  in the directory  /news) will compile  out-of-the
  11076. box on  Linux.   Necessary  patches can  be  found on  sunsite.unc.edu
  11077. in /pub/Linux/system/Mail  (which is,  incidentally,  also where  mail
  11078. software for Linux is found).   Other news  binaries for Linux may  be
  11079. found in this directory as well.
  11080.   For  more  information,   refer  to   the  Linux  News  HOWTO   from
  11081. sunsite.unc.edu  in  /pub/Linux/docs/HOWTO.  Also,  the   LDP's  Linux
  11082. Network  Administrator's  Guide   contains  complete  information   on
  11083. configuring news  software for  Linux.   The  book  Managing UUCP  and
  11084. Usenet, by Tim  O'Reilly and Grace  Todino, is  an excellent guide  to
  11085. setting up UUCP and  news software.   Also of  interest is the  USENET
  11086. document ``How to become a  USENET site,'' available from  ftp.uu.net,
  11087. in the directory /usenet/news.announce.newusers.
  11088.  
  11089.  
  11090.  
  11091.  
  11092.  
  11093.  
  11094.  
  11095.  
  11096. Appendix A
  11097.  
  11098.  
  11099.  
  11100.  
  11101. Sources of Linux Information
  11102.  
  11103.  
  11104.  
  11105. This  appendix  contains  information  on  various  sources  of  Linux
  11106. information, such as online documents, books, and more.  Many of these
  11107. documents are available either in printed form, or electronically from
  11108. the Internet or BBS  systems.   Many Linux distributions also  include
  11109. much of this documentation  in the distribution  itself, so after  you
  11110. have installed Linux these files may be present on your system.
  11111.  
  11112. A.1 Online Documents
  11113.  
  11114. These documents should be  available on any  of the Linux FTP  archive
  11115. sites (see Appendix C for a list).   If you do not have  direct access
  11116. to FTP, you  may be  able to  locate these documents  on other  online
  11117. services (such as CompuServe,  local BBS's, and so  on).  If you  have
  11118. access to Internet mail,  you can use  the ftpmail service to  receive
  11119. these docucments.  See Appendix C for more information.
  11120.   In   particular,   the  following   documents   may  be   found   on
  11121. sunsite.unc.edu in the directory /pub/Linux/docs.   Many sites  mirror
  11122. this directory; however, if you're unable to locate a mirror site near
  11123. you, this is a good one to fall back on.
  11124.   You can  also  access Linux  files and  documentation using  gopher.
  11125. Just point  your gopher  client  to port  70 on  sunsite.unc.edu,  and
  11126. follow the menus to the Linux archive.   This is a good way  to browse
  11127. Linux documentation interactively.
  11128.  
  11129. The Linux Frequently Asked Questions List
  11130.            The Linux  Frequently Asked Questions list, or  ``FAQ'', is
  11131.            a  list of common  questions (and answers!)   about  Linux.
  11132.            This  document is  meant  to provide  a general  source  of
  11133.            information  about Linux,  common  problems and  solutions,
  11134.            and  a list of  other sources  of information.   Every  new
  11135.            Linux user should  read this document.  It is  available in
  11136.            a  number of  formats, including  plain ASCII,  PostScript,
  11137.            and Lout  typesetter format.   The Linux FAQ is  maintained
  11138.            by Ian Jackson, ijackson@nyx.cs.du.edu.
  11139.  
  11140.  
  11141.  
  11142.                                  203
  11143. A.1.   Online Documents                                            204
  11144. _______________________________________________________________________
  11145.  
  11146. The Linux META-FAQ
  11147.            The  META-FAQ is  a collection  of ``metaquestions''  about
  11148.            Linux;  that is,  sources  of information  about the  Linux
  11149.            system,   and  other  general  topics.     It  is   a  good
  11150.            starting place  for the Internet user wishing to  find more
  11151.            information about the system.   It is maintained by Michael
  11152.            K. Johnson, johnsonm@sunsite.unc.edu.
  11153.  
  11154. The Linux INFO-SHEET
  11155.            The  Linux INFO-SHEET  is a technical  introduction to  the
  11156.            Linux  system.    It  gives  an overview  of  the  system's
  11157.            features  and  available  software,  and  also  provides  a
  11158.            list  of   other  sources  of  Linux  information.      The
  11159.            format and  content is similar  in nature to the  META-FAQ;
  11160.            incidentally, it is also maintained by Michael K. Johnson.
  11161.  
  11162. The Linux Software Map
  11163.            The  Linux Software  Map  is a  list of  many  applications
  11164.            available  for  Linux, where  to  get them,  who  maintains
  11165.            them,  and  so  forth.     It  is  far  from  complete---to
  11166.            compile a  complete list of Linux software would  be nearly
  11167.            impossible.    However, it  does include many  of the  most
  11168.            popular  Linux software  packages.    If you  can't find  a
  11169.            particular  application to suit  your needs,  the LSM is  a
  11170.            good place to  start.  It is maintained by  Lars Wirzenius,
  11171.            lars.wirzenius@helsinki.fi.
  11172.  
  11173. The Linux HOWTO Index
  11174.            The Linux HOWTOs are a collection  of ``how to'' documents,
  11175.            each  describing   in  detail  a  certain  aspect   of  the
  11176.            Linux  system.     They  are   maintained  by  Matt  Welsh,
  11177.            mdw@sunsite.unc.edu.    The  HOWTO  Index lists  the  HOWTO
  11178.            documents which are available (several  of which are listed
  11179.            below).
  11180.  
  11181. The Linux Installation HOWTO
  11182.            The  Linux  Installation  HOWTO  describes  how  to  obtain
  11183.            and  install  a  distribution  of  Linux,  similar  to  the
  11184.            information presented in Chapter 2.
  11185. The Linux Distribution HOWTO
  11186.            This  document is a list  of Linux distributions  available
  11187.            via  mail  order  and  anonymous   FTP.  It  also  includes
  11188.            information  on other Linux-related  goodies and  services.
  11189.            Appendix B contains a list of  Linux vendors, many of which
  11190.            are listed in the Distribution HOWTO.
  11191.  
  11192. The Linux XFree86 HOWTO
  11193.            This  document describes how to  install and configure  the
  11194.            X  Window  System software  for Linux.    See  the  section
  11195.            ``5.1'' for more about the X Window System.
  11196. A.2.   Linux Documentation Project Manuals                         205
  11197. _______________________________________________________________________
  11198.  
  11199. The Linux Mail, News, and UUCP HOWTOs
  11200.            These  three  HOWTO documents  describe  configuration  and
  11201.            setup  of electronic  mail, news,  and UUCP  communications
  11202.            on  a  Linux system.    Because  these three  subjects  are
  11203.            often intertwined, you may wish to  read all three of these
  11204.            HOWTOs together.
  11205.  
  11206. The Linux Hardware HOWTO
  11207.            This   HOWTO  contains  an   extensive  list  of   hardware
  11208.            supported by Linux.  While this  list is far from complete,
  11209.            it  should give  you a  general picture  of which  hardware
  11210.            devices should be supported by the system.
  11211.  
  11212. The Linux SCSI HOWTO
  11213.            The Linux  SCSI HOWTO is a complete guide  to configuration
  11214.            and  usage  of  SCSI devices  under  Linux,  such  as  hard
  11215.            drives, tape drives and CD-ROM.
  11216.  
  11217. The Linux NET-2-HOWTO
  11218.            The  Linux NET-2-HOWTO describes  installation, setup,  and
  11219.            configuration  of  the  ``NET-2''   TCP/IP  software  under
  11220.            Linux,  including SLIP. If you want  to use TCP/IP on  your
  11221.            Linux system, this document is a must read.
  11222.  
  11223. The Linux Ethernet HOWTO
  11224.            Closely  related to  the  NET-2-HOWTO, the  Ethernet  HOWTO
  11225.            describes the various Ethernet devices  supported by Linux,
  11226.            and explains how  to configure each of them for use  by the
  11227.            Linux TCP/IP software.
  11228. The Linux Printing HOWTO
  11229.            This document describes how to  configure printing software
  11230.            under Linux,  such as lpr.   Configuration of printers  and
  11231.            printing  software  under UNIX  can  be very  confusing  at
  11232.            times; this document sheds some light on the subject.
  11233.  
  11234. Other online documents
  11235.            If you browse the docs subdirectory  of any Linux FTP site,
  11236.            you'll see many other documents which  are not listed here:
  11237.            A slew  of FAQ's, interesting tidbits, and  other important
  11238.            information.   This miscellany  is difficult to  categorize
  11239.            here; if you don't see what you're  looking for on the list
  11240.            above, just  take a look at one of the Linux  archive sites
  11241.            listed in Appendix C.
  11242.  
  11243.  
  11244.  
  11245. A.2 Linux Documentation Project Manuals
  11246.  
  11247. The Linux  Documentation Project  is working  on developing  a set  of
  11248. manuals and other documentation for Linux, including man pages.  These
  11249. manuals are in various  stages of development,  and any help  revising
  11250. A.3.   Books and Other Published Works                             206
  11251. _______________________________________________________________________
  11252.  
  11253. and updating them is greatly appreciated.  If you have questions about
  11254. the LDP, please contact Matt Welsh (mdw@sunsite.unc.edu).
  11255.   These  books are  available  via  anonymous  FTP from  a  number  of
  11256. Linux archive  sites,   including  sunsite.unc.edu  in  the  directory
  11257. /pub/Linux/docs/LDP. A number of  commercial distributors are  selling
  11258. printed copies of these books; in the future, you may be  able to find
  11259. the LDP manuals on the shelves of your local bookstore.
  11260.  
  11261. Linux Installation and Getting Started, by Matt Welsh
  11262.            A new  user's guide for Linux, covering everything  the new
  11263.            user  needs to know  to get started.    You happen to  hold
  11264.            this book in your hands.
  11265.  
  11266. The Linux System Administrators' Guide, by Lars Wirzenius
  11267.            This  is a  complete  guide to  running and  configuring  a
  11268.            Linux system.   There are  many issues relating to  systems
  11269.            administration which  are specific to Linux, such  as needs
  11270.            for  supporting a user  community, filesystem  maintenance,
  11271.            backups, and more.  This guide covers them all.
  11272.  
  11273. The Linux Network Administrators' Guide, by Olaf Kirch
  11274.            An extensive and complete guide  to networking under Linux,
  11275.            including  TCP/IP, UUCP, SLIP, and  more.   This book is  a
  11276.            very  good read;  it contains  a wealth  of information  on
  11277.            many  subjects, clarifying  the many  confusing aspects  of
  11278.            network configuration.
  11279. The Linux Kernel Hackers' Guide, by Michael Johnson
  11280.            The gritty details of kernel  hacking and development under
  11281.            Linux.  Linux is unique in  that the complete kernel source
  11282.            is  available.   This book  opens the  doors to  developers
  11283.            who  wish to  add  or modify  features within  the  kernel.
  11284.            This guide  also contains comprehensive coverage  of kernel
  11285.            concepts and conventions used by Linux.
  11286.  
  11287.  
  11288.  
  11289. A.3 Books and Other Published Works
  11290.  
  11291. Linux Journal is a monthly magazine for and about the Linux community,
  11292. written and produced by a number of Linux developers  and enthusiasts.
  11293. It is distributed worldwide, and is an excellent way to  keep in touch
  11294. with the dynamics  of the Linux  world, especially  if you don't  have
  11295. access to USENET news.
  11296.   At  the  time  of  this  writing,  subscriptions  to  Linux  Journal
  11297. are US$19/year  in  the United  States,  US$24 in  Canada,  and  US$29
  11298. elsewhere.   To subscribe,  or for  more information,  write to  Linux
  11299. Journal, PO  Box  85867, Seattle,  WA,  98145-1867,  USA, or  call  +1
  11300. 206 527-3385.    Their  FAX  number is  +1  206 527-2806,  and  e-mail
  11301. address is  linux@ssc.com.     You  can  also  find  a  Linux  Journal
  11302. FAQ and  sample  articles  via  anonymous FTP  on  sunsite.unc.edu  in
  11303. /pub/Linux/docs/linux-journal.
  11304. A.3.   Books and Other Published Works                             207
  11305. _______________________________________________________________________
  11306.  
  11307.   As we  have said, not  many books have  been published dealing  with
  11308. Linux specifically.  However, if you are new to the world  of UNIX, or
  11309. want more information than is presented here, we suggest that you take
  11310. a look at the following books which are available.
  11311.  
  11312. A.3.1 Using UNIX
  11313.  
  11314. Title:        Learning the UNIX Operating System
  11315.  
  11316. Author:       Grace Todino & John Strang
  11317. Publisher:    O'Reilly and Associates, 1987
  11318. ISBN:         0-937175-16-1, $9.00
  11319.  
  11320.  
  11321.      A  good introductory  book  on  learning the  UNIX  operating
  11322.     system.  Most of the information should be applicable to Linux
  11323.     as well.   I suggest reading this book  if you're new to  UNIX
  11324.     and really want to get started with using your new system.
  11325.  
  11326.  
  11327. Title:        Learning the vi Editor
  11328. Author:       Linda Lamb
  11329. Publisher:    O'Reilly and Associates, 1990
  11330.  
  11331. ISBN:         0-937175-67-6, $21.95
  11332.  
  11333.  
  11334.      This is  a book about the vi  editor, a powerful text  editor
  11335.     found on every UNIX system in the world.  It's often important
  11336.     to know and be able to  use vi, because you won't always  have
  11337.     access to a ``real'' editor such as Emacs.
  11338.  
  11339. A.3.2 Systems Administration
  11340.  
  11341. Title:        Essential System Administration
  11342. Author:       AEleen Frisch
  11343. Publisher:    O'Reilly and Associates, 1991
  11344.  
  11345. ISBN:         0-937175-80-3, $29.95
  11346.  
  11347.  
  11348.      From the  O'Reilly and Associates  Catalog, ``Like any  other
  11349.     multi-user  system,  UNIX  requires  some  care  and  feeding.
  11350.     Essential System  Administration tells  you how.    This  book
  11351.     strips away the myth and confusion surrounding  this important
  11352.     topic and provides a  compact, manageable introduction to  the
  11353.     tasks faced by  anyone responsible  for a  UNIX system.''    I
  11354.     couldn't have said it better myself.
  11355.  
  11356. Title:        TCP/IP Network Administration
  11357. A.3.   Books and Other Published Works                             208
  11358. _______________________________________________________________________
  11359.  
  11360. Author:       Craig Hunt
  11361. Publisher:    O'Reilly and Associates, 1990
  11362.  
  11363. ISBN:         0-937175-82-X, $24.95
  11364.  
  11365.      A complete guide to setting up and running  a TCP/IP network.
  11366.     While this book is  not Linux-specific, roughly  90% of it  is
  11367.     applicable to Linux.   Coupled with the Linux NET-2-HOWTO  and
  11368.     Linux Network  Administrator's Guide,  this  is a  great  book
  11369.     discussing the  concepts  and technical  details  of  managing
  11370.     TCP/IP.
  11371.  
  11372.  
  11373. Title:        Managing UUCP and Usenet
  11374.  
  11375. Author:       Tim O'Reilly and Grace Todino
  11376. Publisher:    O'Reilly and Associates, 1991
  11377. ISBN:         0-937175-93-5, $24.95
  11378.  
  11379.  
  11380.      This  book   covers  how  to   install  and  configure   UUCP
  11381.     networking software, including configuration for USENET  news.
  11382.     If you're at all interested in using UUCP or  accessing USENET
  11383.     news on your system, this book is a must-read.
  11384.  
  11385. A.3.3 The X Window System
  11386.  
  11387. Title:        The X Window System:  A User's Guide
  11388. Author:       Niall Mansfield
  11389.  
  11390. Publisher:    Addison-Wesley
  11391. ISBN:         0-201-51341-2, ??
  11392.  
  11393.  
  11394.      A  complete  tutorial  and  reference  guide   to  using  the
  11395.     X Window System.   If  you installed X  windows on your  Linux
  11396.     system, and want to  know how to get the  most out of it,  you
  11397.     should read this book.   Unlike some windowing systems, a  lot
  11398.     of the power provided by X is not obvious at first sight.
  11399.  
  11400. A.3.4 Programming
  11401.  
  11402. Title:        The C Programming Language
  11403. Author:       Brian Kernighan and Dennis Ritchie
  11404.  
  11405. Publisher:    Prentice-Hall, 1988
  11406. ISBN:         0-13-110362-8, $25.00
  11407.  
  11408.  
  11409.      This  book  is  a  must-have  for  anyone  wishing  to  do  C
  11410.     programming on  a UNIX  system.    (Or  any system,  for  that
  11411. A.3.   Books and Other Published Works                             209
  11412. _______________________________________________________________________
  11413.  
  11414.     matter.)  While this book is not obstensibly UNIX-specific, it
  11415.     is quite applicable to programming C under UNIX.
  11416.  
  11417.  
  11418. Title:        The Unix Programming Environment
  11419. Author:       Brian Kernighan and Bob Pike
  11420.  
  11421. Publisher:    Prentice-Hall, 1984
  11422. ISBN:         0-13-937681-X, ??
  11423.  
  11424.  
  11425.      An overview  to programming under  the UNIX  system.   Covers
  11426.     all of the tools of the  trade; a good read to  get acquainted
  11427.     with the somewhat amorphous UNIX programming world.
  11428.  
  11429.  
  11430. Title:        Advanced Programming in the UNIX Environment
  11431. Author:       W. Richard Stevens
  11432. Publisher:    Addison-Wesley
  11433. ISBN:         0-201-56317-7, $50.00
  11434.  
  11435.  
  11436.      This mighty  tome contains everything  that you need to  know
  11437.     to program  UNIX  at  the  system  level---file  I/O,  process
  11438.     control, interprocess  communication, signals,  terminal  I/O,
  11439.     the works.    This  book  focuses  on various  UNI  standards,
  11440.     including POSIX.1, which Linux mostly adheres to.
  11441.  
  11442.  
  11443. A.3.5 Kernel Hacking
  11444.  
  11445. Title:        The Design of the UNIX Operating System
  11446. Author:       Maurice J. Bach
  11447. Publisher:    Prentice-Hall, 1986
  11448. ISBN:         0-13-201799-7, ??
  11449.  
  11450.  
  11451.      This book  covers the  algorithms and internals  of the  UNIX
  11452.     kernel.  It is not specific to any particular kernel, although
  11453.     it does lean towards  System V-isms.   This is the best  place
  11454.     to start if you want  to understand the inner tickings of  the
  11455.     Linux system.
  11456.  
  11457.  
  11458. Title:        The Magic Garden Explained
  11459. Author:       Berny Goodheart and James Cox
  11460.  
  11461. Publisher:    Prentice-Hall, 1994
  11462. ISBN:         0-13-098138-9, ??
  11463. A.3.   Books and Other Published Works                             210
  11464. _______________________________________________________________________
  11465.  
  11466.      This  book  describes  the System  V  R4  kernel  in  detail.
  11467.     Unlike  Bach's  book,   which  concentrates  heavily  on   the
  11468.     algorithms which  make the  kernel  tick, this  book  presents
  11469.     the SVR4 implementation on a  more technical level.   Although
  11470.     Linux and SVR4  are distant  cousins, this book  can give  you
  11471.     much insight  into  the  workings  of an  actual  UNIX  kernel
  11472.     implementation.  This is also  a very modern book on the  UNIX
  11473.     kernel---published in 1994.
  11474.  
  11475.  
  11476.  
  11477.  
  11478.  
  11479.  
  11480.  
  11481.  
  11482. Appendix B
  11483.  
  11484.  
  11485.  
  11486.  
  11487. Linux Vendor List
  11488.  
  11489.  
  11490.  
  11491. This appendix lists contact information for a number of  vendors which
  11492. sell Linux on diskette, tape,  and CD-ROM. Many of them  provide Linux
  11493. documentation, support, and  other services as  well.   This is by  no
  11494. means a complete listing; if you purchased this book  in printed form,
  11495. it's very possible that the vendor or publishing company also provides
  11496. Linux software and services.
  11497.   The author  makes no  guarantee as  to the  accuracy of  any of  the
  11498. information listed in  this Appendix.   This  information is  included
  11499. here only as  a service to  readers, not as  an advertisement for  any
  11500. particular organization.
  11501.  
  11502.     Fintronic Linux Systems
  11503.     1360 Willow Rd., Suite 205
  11504.     Menlo Park, CA 94025 USA
  11505.     Tel:  +1 415 325-4474
  11506.     Fax:  +1 415 325-4908
  11507.     linux@fintronic.com
  11508.  
  11509.     InfoMagic, Inc.
  11510.     PO Box 30370
  11511.     Flagstaff, AZ 86003-0370 USA
  11512.     Tel:  +1 800 800-6613, +1 602 526-9565
  11513.     Fax:  +1 602 526-9573
  11514.     Orders@InfoMagic.com
  11515.  
  11516.     Lasermoon Ltd
  11517.     2a Beaconsfield Road, Fareham,
  11518.     Hants, England.  PO16 0QB.
  11519.     Tel:  +44 (0) 329 826444.
  11520.     Fax:  +44 (0) 329 825936.
  11521.     info@lasermoon.co.uk
  11522.  
  11523.  
  11524.     Linux Journal
  11525.     P.O. Box 85867
  11526.     Seattle, WA 98145-1867 USA
  11527.  
  11528.                                  211
  11529. A.3.   Books and Other Published Works                             212
  11530. _______________________________________________________________________
  11531.  
  11532.     Tel:  +1 206 527-3385
  11533.     Fax:  +1 206 527-2806
  11534.     linux@ssc.com
  11535.  
  11536.     Linux Systems Labs
  11537.     18300 Tara Drive
  11538.     Clinton Twp, MI 48036 USA
  11539.     Tel:  +1 313 954-2829, +1 800 432-0556
  11540.     Fax:  +1 313 954-2806
  11541.     info@lsl.com
  11542.  
  11543.     Morse Telecommunication, Inc.
  11544.     26 East Park Avenue, Suite 240
  11545.     Long Beach, NY 11561 USA
  11546.     Tel:  +1 800 60-MORSE
  11547.     Fax:  +1 516 889-8665
  11548.     Linux@morse.net
  11549.  
  11550.     Nascent Technology
  11551.     Linux from Nascent CDROM
  11552.     P.O. Box 60669
  11553.     Sunnyvale CA 94088-0669 USA
  11554.     Tel:  +1 408 737-9500
  11555.     Fax:  +1 408 241-9390
  11556.     nascent@netcom.com
  11557.  
  11558.     Red Hat Software
  11559.     P.O. Box 4325
  11560.     Chapel Hill, NC 27515 USA
  11561.     Tel:  +1 919 309-9560
  11562.     redhat@redhat.com
  11563.  
  11564.  
  11565.     SW Technology
  11566.     251 West Renner Suite 229
  11567.     Richardson, TX 75080 USA
  11568.     Tel:  +1 214 907-0871
  11569.     swt@netcom.com
  11570.  
  11571.     Takelap Systems Ltd.
  11572.     The Reddings, Court Robin Lane,
  11573.     Llangwm, Usk, Gwent, United Kingdom NP5 1ET.
  11574.     Tel:  +44 (0)291 650357
  11575.     Fax:  +44 (0)291 650500
  11576.     info@ddrive.demon.co.uk
  11577.  
  11578.     Trans-Ameritech Enterprises, Inc.
  11579.     2342A Walsh Ave
  11580.     Santa Clara, CA 95051 USA
  11581.     Tel:  +1 408 727-3883
  11582.     roman@trans-ameritech.com
  11583. A.3.   Books and Other Published Works                             213
  11584. _______________________________________________________________________
  11585.  
  11586.     Unifix Software GmbH
  11587.     Postfach 4918
  11588.     D-38039 Braunschweig
  11589.     Germany
  11590.     Tel:  +49 (0)531 515161
  11591.     Fax:  +49 (0)531 515162
  11592.  
  11593.     Yggdrasil Computing, Incorporated
  11594.     4880 Stevens Creek Blvd., Suite 205
  11595.     San Jose, CA 95129-1034 USA
  11596.     Tel:  +1 800 261-6630, +1 408 261-6630
  11597.     Fax:  +1 408 261-6631
  11598.     info@yggdrasil.com
  11599.  
  11600.  
  11601.  
  11602.  
  11603.  
  11604.  
  11605.  
  11606.  
  11607. Appendix C
  11608.  
  11609.  
  11610.  
  11611.  
  11612. FTP Tutorial and Site List
  11613.  
  11614.  
  11615.  
  11616. FTP (``File Transfer Protocol'') is the set of programs that  are used
  11617. for transferring files between  systems on the  Internet.  Most  UNIX,
  11618. VMS, and MS-DOS  systems on  the Internet  have a  program called  ftp
  11619. which you  use to  transfer  these files,  and  if you  have  Internet
  11620. access, the best way to download  the Linux software is by  using ftp.
  11621. This appendix covers basic ftp usage---of course, there are  many more
  11622. functions and uses of ftp than are given here.
  11623.   At the end  of this appendix there is  a listing of FTP  sites where
  11624. Linux software can be found.  Also, if you don't  have direct Internet
  11625. access but are  able to  exchange electronic mail  with the  Internet,
  11626. information on using the ftpmail service is included below.
  11627.   If you're  using an MS-DOS,  UNIX, or VMS  system to download  files
  11628. from the Internet,  then ftp is  a command-driven  program.   However,
  11629. there are  other  implementations  of  ftp  out  there,  such  as  the
  11630. Macintosh version (called  Fetch) with  a nice menu-driven  interface,
  11631. which is  quite  self-explanatory.    Even  if you're  not  using  the
  11632. command-driven version of ftp, the information given here should help.
  11633.  
  11634.  
  11635.   ftp can be  used to both upload  (send) or download (receive)  files
  11636. from other Internet  sites.   In most situations,  you're going to  be
  11637. downloading software.   On the  Internet there are  a large number  of
  11638. publicly-available FTP archive sites,  machines which allow anyone  to
  11639. ftp to them  and download  free software.   One  such archive site  is
  11640. sunsite.unc.edu, which has  a lot  of Sun  Microsystems software,  and
  11641. acts as one of the main Linux  sites.  In addition, FTP  archive sites
  11642. mirror software to each other---that is, software uploaded to one site
  11643. will be automatically  copied over  to a number  of other  sites.   So
  11644. don't be surprised if you see  the exact same files on  many different
  11645. archive sites.
  11646.  
  11647. C.1 Starting ftp
  11648.  
  11649. Note that in the  example ``screens'' printed  below I'm only  showing
  11650. the most important information,  and what you see  may differ.   Also,
  11651.  
  11652.  
  11653.                                  214
  11654. C.2.   Logging In                                                  215
  11655. _______________________________________________________________________
  11656.  
  11657. commands in italics represent commands that you type;  everything else
  11658. is screen output.
  11659.   To start ftp and connect to a site, simply use the command
  11660.  
  11661.     ftp <hostname>
  11662.  
  11663. where <hostname> is the name  of the site you are  connecting to.  For
  11664. example, to connect to the  mythical site shoop.vpizza.com we  can use
  11665. the command
  11666.  
  11667.     ftp shoop.vpizza.com
  11668.  
  11669.  
  11670. C.2 Logging In
  11671.  
  11672. When ftp starts up we should see something like
  11673.  
  11674.     Connected to shoop.vpizza.com.
  11675.     220 Shoop.vpizza.com FTPD ready at 15 Dec 1992 08:20:42 EDT
  11676.     Name (shoop.vpizza.com:mdw):
  11677.  
  11678. Here, ftp is asking us to give  the username that we want to  login as
  11679. on shoop.vpizza.com.   The default here is  mdw, which is my  username
  11680. on the system  I'm using  FTP from.   Since  I don't  have an  account
  11681. on shoop.vpizza.com  I can't  login as  myself.   Instead,  to  access
  11682. publicly-available software on an FTP site you login as anonymous, and
  11683. give your Internet e-mail address  (if you have one) as  the password.
  11684. So, we would type
  11685.  
  11686.     Name (shoop.vpizza.com:mdw):  anonymous
  11687.     331-Guest login ok, send e-mail address as password.
  11688.     Password:  mdw@sunsite.unc.edu
  11689.     230- Welcome to shoop.vpizza.com.
  11690.     230- Virtual Pizza Delivery[tm]:  Download pizza in  30 cycles
  11691.     or less
  11692.     230- or you get it FREE!
  11693.     ftp>
  11694.  
  11695. Of course,  you should  give  your e-mail  address,  instead of  mine,
  11696. and it  won't echo  to  the screen  as you're  typing  it (since  it's
  11697. technically a ``password'').  ftp  should allow us to login  and we'll
  11698. be ready to download software.
  11699.  
  11700. C.3 Poking Around
  11701.  
  11702. Okay, we're in.   ftp> is our prompt,  and the ftp program is  waiting
  11703. for commands.  There are a few basic commands you need  to know about.
  11704. First, the commands
  11705.  
  11706.     ls <file>
  11707. C.3.   Poking Around                                               216
  11708. _______________________________________________________________________
  11709.  
  11710. and
  11711.  
  11712.     dir <file>
  11713.  
  11714. both  give  file  listings  (where  <file>  is  an  optional  argument
  11715. specifying a particular  filename to list).    The difference is  that
  11716. ls usually  gives a  short  listing and  dir  gives a  longer  listing
  11717. (that is, with more  information on the sizes  of the files, dates  of
  11718. modification, and so on).
  11719.   The command
  11720.  
  11721.     cd <directory>
  11722.  
  11723. will move to the given directory (just like the cd command  on UNIX or
  11724. MS-DOS systems).  You can use the command
  11725.  
  11726.     cdup
  11727.  
  11728. to change to the parent directory(1).
  11729.   The command
  11730.  
  11731.     help <command>
  11732.  
  11733. will give help on the given  ftp <command> (such as ls  or cd).  If no
  11734. command is specified, ftp will list all of the available commands.
  11735.   If we type dir at this point we'll see  an initial directory listing
  11736. of where we are.
  11737.  
  11738.     ftp> dir
  11739.     200 PORT command successful.
  11740.     150 Opening ASCII mode data connection for /bin/ls.
  11741.     total 1337
  11742.  
  11743.  
  11744.  
  11745.     dr-xr-xr-x  2 root     wheel         512 Aug 13 13:55 bin
  11746.     drwxr-xr-x  2 root     wheel         512 Aug 13 13:58 dev
  11747.     drwxr-xr-x  2 root     wheel         512 Jan 25 17:35 etc
  11748.     drwxr-xr-x 19 root     wheel        1024 Jan 27 21:39 pub
  11749.     drwxrwx-wx  4 root     ftp-admi     1024 Feb  6 22:10 uploads
  11750.     drwxr-xr-x  3 root     wheel         512 Mar 11  1992 usr
  11751.  
  11752.  
  11753.     226 Transfer complete.
  11754.     921 bytes received in 0.24 seconds (3.7 Kbytes/s)
  11755.     ftp>
  11756.  
  11757. ----------------------------
  11758.  1. The directory above the current one.
  11759. C.4.   Downloading files                                           217
  11760. _______________________________________________________________________
  11761.  
  11762.   Each of these entries  is a directory, not an individual  file which
  11763. we can  download  (specified by  the  d in  the  first column  of  the
  11764. listing).  On most FTP archive sites, the  publicly available software
  11765. is under the directory /pub, so let's go there.
  11766.  
  11767.     ftp> cd pub
  11768.     ftp> dir
  11769.     200 PORT command successful.
  11770.     150 ASCII data connection  for /bin/ls (128.84.181.1,4525)  (0
  11771.     bytes).
  11772.     total 846
  11773.  
  11774.  
  11775.  
  11776.     -rw-r--r--  1 root   staff     1433 Jul 12  1988 README
  11777.     -r--r--r--  1 3807   staff    15586 May 13  1991  US-DOMAIN.TXT.2
  11778.     -rw-r--r--  1 539    staff    52664 Feb 20  1991 altenergy.avail
  11779.     -r--r--r--  1 65534  65534    56456 Dec 17  1990 ataxx.tar.Z
  11780.     -rw-r--r--  1 root   other  2013041 Jul  3  1991 gesyps.tar.Z
  11781.     -rw-r--r--  1 432    staff    41831 Jan 30  1989 gnexe.arc
  11782.     -rw-rw-rw-  1 615    staff    50315 Apr 16  1992 linpack.tar.Z
  11783.     -r--r--r--  1 root   wheel    12168 Dec 25  1990 localtime.o
  11784.     -rw-r--r--  1 root   staff     7035 Aug 27  1986 manualslist.tblms
  11785.     drwxr-xr-x  2 2195   staff      512 Mar 10 00:48 mdw
  11786.     -rw-r--r--  1 root   staff     5593 Jul 19  1988 t.out.h
  11787.  
  11788.  
  11789.     226 ASCII Transfer complete.
  11790.     2443 bytes received in 0.35 seconds (6.8 Kbytes/s)
  11791.     ftp>
  11792.  
  11793.   Here we can see a  number of (interesting?)  files, one of  which is
  11794. called README, which we should download (most FTP sites have  a README
  11795. file in the /pub directory).
  11796.  
  11797.  
  11798. C.4 Downloading files
  11799.  
  11800. Before downloading files, there are a few things that you need to take
  11801. care of.
  11802.  
  11803.  o  Turn on hash mark printing.  Hash marks are printed  to the screen
  11804.     as files are being  transferred; they let  you know how far  along
  11805.     the transfer is, and that  your connection hasn't hung up  (so you
  11806.     don't sit for 20 minutes, thinking that you're still downloading a
  11807. C.4.   Downloading files                                           218
  11808. _______________________________________________________________________
  11809.  
  11810.     file).  In general, a hash  mark appears as a pound sign  (#), and
  11811.     one is printed for every 1024 or 8192 bytes transferred, depending
  11812.     on your system.
  11813.  
  11814.     To turn on hash mark printing, give the command hash.
  11815.  
  11816.  
  11817.         ftp> hash
  11818.         Hash mark printing on (8192 bytes/hash mark).
  11819.         ftp>
  11820.  
  11821.  
  11822.  o  Determine the type of file which  you are downloading.  As  far as
  11823.     FTP is concerned,  files come in  two flavors:   binary and  text.
  11824.     Most of the  files which you'll be  downloading are binary  files:
  11825.     that is, programs,  compressed files,  archive files,  and so  on.
  11826.     However, many files (such as READMEs and so on) are text files.
  11827.  
  11828.     Why does the file type matter?  Only because on some systems (such
  11829.     as MS-DOS systems),  certain characters  in a text  file, such  as
  11830.     carriage returns, need to  be converted so  that the file will  be
  11831.     readable.   While transferring  in binary mode,  no conversion  is
  11832.     done---the file is simply transferred byte after byte.
  11833.  
  11834.     The commands bin  and ascii set  the transfer  mode to binary  and
  11835.     text, respectively.   When  in doubt,  always use  binary mode  to
  11836.     transfer files.   If  you try to  transfer a  binary file in  text
  11837.     mode, you'll corrupt the file and  it will be unusable.   (This is
  11838.     one of the most common mistakes made when using FTP.) However, you
  11839.     can use text mode for plain text files (whose  filenames often end
  11840.     in .txt).
  11841.  
  11842.     For our example, we're downloading the file README, which  is most
  11843.     likely a text file, so we use the command
  11844.  
  11845.  
  11846.         ftp> ascii
  11847.         200 Type set to A.
  11848.         ftp>
  11849.  
  11850.  
  11851.  o  Set your local directory.   Your local directory is  the directory
  11852.     on your system  where you  want the  downloaded files  to end  up.
  11853.     Whereas the cd command changes the remote directory (on the remote
  11854.     machine which you're FTPing to), the lcd command changes the local
  11855.     directory.
  11856.  
  11857.     For example, to set  the local directory to /home/db/mdw/tmp,  use
  11858.     the command
  11859. C.5.   Quitting FTP                                                219
  11860. _______________________________________________________________________
  11861.  
  11862.         ftp> lcd /home/db/mdw/tmp
  11863.         Local directory now /home/db/mdw/tmp
  11864.         ftp>
  11865.  
  11866.  
  11867.   Now you're ready to actually download the file.  The command
  11868.  
  11869.     get <remote-name> <local-name>
  11870.  
  11871. is used for this, where  <remote-name> is the name  of the file on the
  11872. remote machine, and <local-name> is the name that you wish to give the
  11873. file on your local machine.  The <local-name> argument is optional; by
  11874. default, the local filename is the  same as the remote one.   However,
  11875. if for example  you're downloading  the file README,  and you  already
  11876. have a README in your local directory, you'll want to give a different
  11877. <local-filename> so that the first one isn't overwritten.
  11878.   For our example, to download the file README, we simply use
  11879.  
  11880.     ftp> get README
  11881.     200 PORT command successful.
  11882.     150 ASCII data connection for README (128.84.181.1,4527) (1433
  11883.     bytes).
  11884.     #
  11885.     226 ASCII Transfer complete.
  11886.     local:  README remote:  README
  11887.     1493 bytes received in 0.03 seconds (49 Kbytes/s)
  11888.     ftp>
  11889.  
  11890.  
  11891. C.5 Quitting FTP
  11892.  
  11893. To end your FTP session, simply use the command
  11894.  
  11895.     quit
  11896.  
  11897. The command
  11898.  
  11899.     close
  11900.  
  11901. can be used to close the connection with the current  remote FTP site;
  11902. the open command can then be used to start a session with another site
  11903. (without quitting the FTP program altogether).
  11904.  
  11905.     ftp> close
  11906.     221 Goodbye.
  11907.     ftp> quit
  11908. C.6.   Using ftpmail                                               220
  11909. _______________________________________________________________________
  11910.  
  11911. C.6 Using ftpmail
  11912.  
  11913. ftpmail is a service which allows you to obtain files from FTP archive
  11914. sites via Internet electronic mail.  If you don't have direct Internet
  11915. access, but are able to send mail to the Internet (from a service such
  11916. as CompuServe, for example), ftpmail is  a good way to get  files from
  11917. FTP archive sites.    Unfortunately, ftpmail can  be slow,  especially
  11918. when sending large jobs.  Before attempting to download  large amounts
  11919. of software using ftpmail, be sure  that your mail spool will  be able
  11920. to handle the incoming traffic.  Many systems keep  quotas on incoming
  11921. electronic mail, and may delete your account if your mail exceeds this
  11922. quota.  Just use common sense.
  11923.   sunsite.unc.edu, one of the  major Linux FTP archive sites,  is home
  11924. to an ftpmail server.  To use this service, send electronic mail to
  11925.  
  11926.     ftpmail@sunsite.unc.edu
  11927.  
  11928. with a message body containing only the word:
  11929.  
  11930.     help
  11931.  
  11932. This will  send  you back  a  list of  ftpmail  commands and  a  brief
  11933. tutorial on using the system.
  11934.   For  example,   to   get  a   listing  of  Linux   files  found   on
  11935. sunsite.unc.edu, send mail to the above address containing the text
  11936.  
  11937.     open sunsite.unc.edu
  11938.     cd /pub/Linux
  11939.     dir
  11940.     quit
  11941.  
  11942.   You may use the ftpmail service to connect to  any FTP archive site;
  11943. you are not  limited to  sunsite.unc.edu.   The next  section lists  a
  11944. number of Linux FTP archives.
  11945.  
  11946.  
  11947. C.7 Linux FTP Site List
  11948.  
  11949. Table C.1 is a listing of the most well-known FTP  archive sites which
  11950. carry the Linux software.   Keep in mind that many other  sites mirror
  11951. these, and more than likely you'll run into Linux on a number of sites
  11952. not on this list.
  11953.   tsx-11.mit.edu,  sunsite.unc.edu, and  nic.funet.fi  are the  ``home
  11954. sites'' for the  Linux software,  where most  of the  new software  is
  11955. uploaded.  Most of the other sites on the list mirror some combination
  11956. of these three.   To  reduce network  traffic, choose  a site that  is
  11957. geographically closest to you.
  11958. C.7.   Linux FTP Site List                                         221
  11959. _______________________________________________________________________
  11960.  
  11961.  
  11962.  
  11963.  
  11964.  
  11965.  
  11966.  
  11967.  
  11968.  
  11969.  
  11970.  
  11971.  
  11972.  
  11973.  
  11974.  
  11975.  
  11976.  
  11977.  Sitename                       IP Address       Directory
  11978.  
  11979.  tsx-11.mit.edu                 18.172.1.2       /pub/linux
  11980.  sunsite.unc.edu                152.2.22.81      /pub/Linux
  11981.  nic.funet.fi                   128.214.6.100    /pub/OS/Linux
  11982.  ftp.mcc.ac.uk                  130.88.200.7     /pub/linux
  11983.  fgb1.fgb.mw.tu-muenchen.de     129.187.200.1    /pub/linux
  11984.  ftp.informatik.tu-muenchen.de  131.159.0.110    /pub/Linux
  11985.  ftp.dfv.rwth-aachen.de         137.226.4.105    /pub/linux
  11986.  ftp.informatik.rwth-aachen.de  137.226.112.172  /pub/Linux
  11987.  ftp.ibp.fr                     132.227.60.2     /pub/linux
  11988.  kirk.bu.oz.au                  131.244.1.1      /pub/OS/Linux
  11989.  ftp.uu.net                     137.39.1.9       /systems/unix/linux
  11990.  wuarchive.wustl.edu            128.252.135.4    /systems/linux
  11991.  ftp.win.tue.nl                 131.155.70.100   /pub/linux
  11992.  ftp.ibr.cs.tu-bs.de            134.169.34.15    /pub/os/linux
  11993.  ftp.denet.dk                   129.142.6.74     /pub/OS/linux
  11994.  
  11995.                      Table C.1:  Linux FTP Sites
  11996.  
  11997.  
  11998.  
  11999.  
  12000.  
  12001.  
  12002.  
  12003.  
  12004. Appendix D
  12005.  
  12006.  
  12007.  
  12008.  
  12009. Linux BBS List
  12010.  
  12011.  
  12012.  
  12013. Printed here is  a list of  bulletin board  systems (BBS) which  carry
  12014. Linux software.  Zane Healy (healyzh@holonet.net) maintains this list.
  12015. If you know of or run a BBS which provides Linux  software which isn't
  12016. on this list, you should get in touch with him.
  12017.   The Linux  community  is no  longer an  Internet-only society.    In
  12018. fact, it is now estimated that the majority of Linux  users don't have
  12019. Internet access.    Therefore, it  is especially  important that  BBSs
  12020. continue to provide and support Linux to users worldwide.
  12021.  
  12022. D.1 United States
  12023.  
  12024. Citrus Grove Public Access, 916-381-5822.  ZyXEL 16.8/14.4 Sacramento,
  12025.   CA. Internet:  citrus.sac.ca.us
  12026. Higher Powered BBS, 408-737-7040.  ?  CA. RIME ->HIGHER
  12027. hip-hop, 408-773-0768.  19.2k Sunnyvale, CA. USENET access
  12028. hip-hop, 408-773-0768.  38.4k Sunnyvale, CA.
  12029. Unix Online, 707-765-4631.  9600 Petaluma, CA. USENET access
  12030. The Outer Rim, 805-252-6342.    Santa Clarita, CA.
  12031. Programmer's Exchange, 818-444-3507.    El Monte, CA. Fidonet
  12032. Programmer's Exchange, 818-579-9711.    El Monte, CA.
  12033. Micro Oasis, 510-895-5985.  14.4k San Leandro, CA.
  12034. Test Engineering, 916-928-0504.    Sacramento, CA.
  12035. Slut Club, 813-975-2603.   USR/DS 16.8k  HST/14.4K Tampa, FL.  Fidonet
  12036.   1:377/42
  12037. Lost City Atlantis, 904-727-9334.  14.4k Jacksonville, FL. FidoNet
  12038. Aquired Knowledge, 305-720-3669.   14.4k v.32bis Ft.  Lauderdale,  FL.
  12039.   Internet, UUCP
  12040. The Computer Mechanic, 813-544-9345.   14.4k v.32bis St.   Petersburg,
  12041.   FL. Fidonet, Sailnet, MXBBSnet
  12042. AVSync, 404-320-6202.    Atlanta, GA.
  12043. Information Overload, 404-471-1549.  19.2k ZyXEL Atlanta,  GA. Fidonet
  12044.   1:133/308
  12045. Atlanta Radio Club, 404-850-0546.  9600 Atlanta, GA.
  12046. Rebel BBS, 208-887-3937.  9600 Boise, ID.
  12047. Rocky Mountain HUB, 208-232-3405.  38.4k Pocatello, ID. Fionet, SLNet,
  12048.  
  12049.  
  12050.                                  222
  12051. D.1.   United States                                               223
  12052. _______________________________________________________________________
  12053.  
  12054.   CinemaNet
  12055. EchoMania, 618-233-1659.  14.4k HST Belleville, IL.  Fidonet 1:2250/1,
  12056.   f'req LINUX
  12057. UNIX USER, 708-879-8633.  14.4k Batavia, IL. USENET, Internet mail
  12058. PBS BBS, 309-663-7675.  2400 Bloomington, IL.
  12059. Third World, 217-356-9512.  9600 v.32 IL.
  12060. Digital Underground, 812-941-9427.  14.4k v.32bis IN. USENET
  12061. The OA  Southern Star,  504-885-5928.       New  Orleans, LA.  Fidonet
  12062.   1:396/1
  12063. Channel One, 617-354-8873.    Boston, MA. RIME ->CHANNEL
  12064. VWIS Linux Support BBS, 508-793-1570.  9600 Worcester, MA.
  12065. WayStar BBS, 508-481-7147.    14.4k V.32bis  USR/HST Marlborough,  MA.
  12066.   Fidonet 1:333/14
  12067. WayStar BBS, 508-481-7293.    14.4k V.32bis  USR/HST Marlborough,  MA.
  12068.   Fidonet 1:333/15
  12069. WayStar BBS, 508-480-8371.  9600 V.32bis or 14.4k USR/HST Marlborough,
  12070.   MA. Fidonet 1:333/16
  12071. Programmer's Center, 301-596-1180.  9600 Columbia, MD. RIME
  12072. Brodmann's Place, 301-843-5732.   14.4k Waldorf, MD. RIME  ->BRODMANN,
  12073.   Fidonet
  12074. Main Frame, 301-654-2554.  9600 Gaithersburg, MD. RIME ->MAINFRAME
  12075. 1 Zero Cybernet BBS, 301-589-4064.    MD.
  12076. WaterDeep BBS, 410-614-2190.  9600 v.32 Baltimore, MD.
  12077. Harbor Heights BBS, 207-663-0391.  14.4k Boothbay Harbor, ME.
  12078. Part-Time BBS, 612-544-5552.  14.4k v.32bis Plymouth, MN.
  12079. The Sole  Survivor, 314-846-2702.    14.4k  v.32bis St.    Louis,  MO.
  12080.   WWIVnet, WWIVlink, etc
  12081. MAC's Place, 919-891-1111.  16.8k, DS modem Dunn, NC. RIME ->MAC
  12082. Digital Designs, 919-423-4216.  14.4k, 2400 Hope Mills, NC.
  12083. Flite Line, 402-421-2434.    Lincoln, NE. RIME ->FLITE, DS modem
  12084. Legend, 402-438-2433.    Lincoln, NE. DS modem
  12085. MegaByte Mansion, 402-551-8681.  14.4 V,32bis Omaha, NE.
  12086. Mycroft QNX, 201-858-3429.  14.4k NJ.
  12087. Steve Leon's, 201-886-8041.  14.4k Cliffside Park, NJ.
  12088. Dwight-Englewood BBS, 201-569-3543.  9600 v.42 Englewood, NJ. USENET
  12089. The Mothership Cnection, 908-940-1012.  38.4k Franklin Park, NJ.
  12090. The Laboratory, 212-927-4980.   16.8k HST,  14.4k v.32bis NY.  FidoNet
  12091.   1:278/707
  12092. Valhalla,  516-321-6819.     14.4k  HST  v.32  Babylon,   NY.  Fidonet
  12093.   (1:107/255), UseNet (die.linet.org)
  12094. Intermittent Connection, 503-344-9838.  14.4k HST v.32bis  Eugene, OR.
  12095.   1:152/35
  12096. Horizon Systems, 216-899-1086.  USR v.32 Westlake, OH.
  12097. Horizon Systems, 216-899-1293.  2400 Westlake, OH.
  12098. Centre Programmers Unit, 814-353-0566.  14.4k  V.32bis/HST Bellefonte,
  12099.   PA.
  12100. Allentown Technical, 215-432-5699.   9600 v.32/v.42bis Allentown,  PA.
  12101.   WWIVNet 2578
  12102. Tactical-Operations, 814-861-7637.  14.4k V32bis/V42bis State College,
  12103.   PA. Fidonet 1:129/226, tac_ops.UUCP
  12104. D.2.   Outside of the United States                                224
  12105. _______________________________________________________________________
  12106.  
  12107. North Shore BBS, 713-251-9757.    Houston, TX.
  12108. The Annex, 512-575-1188.  9600 HST TX. Fidonet 1:3802/217
  12109. The Annex, 512-575-0667.  2400 TX. Fidonet 1:3802/216
  12110. Walt Fairs, 713-947-9866.    Houston, TX. FidoNet 1:106/18
  12111. CyberVille, 817-249-6261.  9600 TX. FidoNet 1:130/78
  12112. splat-ooh, 512-578-2720.  14.4k Victoria, TX.
  12113. splat-ooh, 512-578-5436.  14.4k Victoria, TX.
  12114. alaree, 512-575-5554.  14.4k Victoria, TX.
  12115. Ronin BBS, 214-938-2840.   14.4 HST/DS Waxahachie (Dallas),  TX. RIME,
  12116.   Intelec, Smartnet, etc.
  12117. VTBBS, 703-231-7498.    Blacksburg, VA.
  12118. MBT, 703-953-0640.    Blacksburg, VA.
  12119. NOVA, 703-323-3321.  9600 Annandale, VA. Fidonet 1:109/305
  12120. Rem-Jem, 703-503-9410.  9600 Fairfax, VA.
  12121. Enlightend, 703-370-9528.  14.4k Alexandria, VA. Fidonet 1:109/615
  12122. My UnKnown BBS, 703-690-0669.  14.4k V.32bis VA. Fidonet 1:109/370
  12123. Georgia Peach BBS, 804-727-0399.  14.4k Newport News, VA.
  12124. Top Hat BBS, 206-244-9661.  14.4k WA. Fidonet 1:343/40
  12125. victrola.sea.wa.us, 206-838-7456.  19.2k Federal Way, WA. USENET
  12126.  
  12127.  
  12128.  
  12129. D.2 Outside of the United States
  12130.  
  12131. Galaktische Archive,   0043-2228303804.     16.8  ZYX  Wien,  Austria.
  12132.   Fidonet 2:310/77 (19:00-7:00)
  12133. Linux-Support-Oz,  +61-2-418-8750.      v.32bis  14.4k  Sydney,   NSW,
  12134.   Austrailia.  Internet/Usenet, E-Mail/News
  12135. 500cc  Formula  1  BBS,   +61-2-550-4317.      V.32bis  Sydney,   NSW,
  12136.   Australia.
  12137. Magic BBS, 403-569-2882.   14.4k HST/Telebit/MNP Calgary, AB,  Canada.
  12138.   Internet/Usenet
  12139. Logical Solutions, 299-9900 through 9911.  2400 AB, Canada.
  12140. Logical Solutions, 299-9912, 299-9913.  14.4k Canada.
  12141. Logical Solutions, 299-9914 through 9917.  16.8k v.32bis Canada.
  12142. V.A.L.I.S., 403-478-1281.  14.4k v.32bis Edmonton, AB, Canada.  USENET
  12143. The Windsor Download, (519)-973-9330.  v32bis 14.4 ON, Canada.
  12144. r-node, 416-249-5366.  2400 Toronto, ON, Canada.  USENET
  12145. Synapse, 819-246-2344.    819-561-5268 Gatineau,  QC, Canada.    
  12146.   RIME->SYNAPSE
  12147. Radio Free Nyongwa, 514-524-0829.  v.32bis ZyXEL Montreal, QC, Canada.
  12148.   USENET, Fidonet
  12149. DataComm1, +49.531.132-16.  14.4 HST Braunschweig, NDS, Germany.  Fido
  12150.   2:240/550, LinuxNet
  12151. DataComm2, +49.531.132-17.  14.4 HST Braunschweig, NDS, Germany.  Fido
  12152.   2:240/551, LinuxNet
  12153. Linux Server /Braukmann,  +49.441.592-963.   16.8 ZYX Oldenburg,  NDS,
  12154.   Germany.  Fido 2:241/2012, LinuxNet
  12155. MM's Spielebox, +49.5323.3515.  14.4 ZYX Clausthal-Zfd., NDS, Germany.
  12156.   Fido 2:241/3420
  12157. MM's Spielebox, +49.5323.3516.  16.8 ZYX Clausthal-Zfd., NDS, Germany.
  12158. D.2.   Outside of the United States                                225
  12159. _______________________________________________________________________
  12160.  
  12161.   Fido 2:241/3421
  12162. MM's Spielebox,  +49.5323.3540.   9600  Clausthal-Zfd., NDS,  Germany.
  12163.   Fido 2:241/3422
  12164. Bit-Company / J. Bartz,  +49.5323.2539.   16.8 ZYX MO  Clausthal-Zfd.,
  12165.   NDS, Germany.  Fido 2:241/3430
  12166. Fractal Zone BBS  /Maass, +49.721.863-066.   16.8  ZYX Karlsruhe,  BW,
  12167.   Germany.  Fido 2:241/7462
  12168. Hipposoft /M. Junius, +49.241.875-090.  14.4 HST Aachen, NRW, Germany.
  12169.   Fido 2:242/6, 4:30-7,8-23:30
  12170. UB-HOFF /A. Hoffmann, +49.203.584-155.   19.2 ZYX+ Duisburg,  Germany.
  12171.   Fido 2:242/37
  12172. FORMEL-Box, +49.4191.2846.    16.8  ZYX Kaltenkirchen,  SHL,  Germany.
  12173.   Fido 2:242/329, LinuxNet (6:00-20:00)
  12174. BOX/2, +49.89.601-96-77.    16.8 ZYX  Muenchen,  BAY, Germany.    Fido
  12175.   2:246/147, info magic:  LINUX (22-24,0:30-2,5-8)
  12176. Die Box Passau 2+1, +49.851.555-96.   14.4 V32b Passau,  BAY, Germany.
  12177.   Fido 2:246/200 (8:00-3:30)
  12178. Die Box  Passau  Line 1,  +49.851.753-789.    16.8  ZYX  Passau,  BAY,
  12179.   Germany.  Fido 2:246/2000 (8:00-3:30)
  12180. Die Box Passau Line 3, +49.851.732-73.  14.4 HST Passau, BAY, Germany.
  12181.   Fido 2:246/202 (5:00-3:30)
  12182. Die Box Passau  ISDN, +49.851.950-464.    38.4/64k V.110/X.75  Passau,
  12183.   BAY, Germany.  Fido 2:246/201 (8:00-24:00,1:00-3:30)
  12184. Public Domain Kiste, +49.30.686-62-50.   16.8 ZYX BLN, Germany.   Fido
  12185.   2:2403/17
  12186. CS-Port /  C.  Schmidt,  +49.30.491-34-18.    19.2  Z19  Berlin,  BLN,
  12187.   Germany.  Fido 2:2403/13
  12188. BigBrother /  R. Gmelch,  +49.30.335-63-28.    16.8 Z16  Berlin,  BLN,
  12189.   Germany.  Fido 2:2403/36.4 (16-23:00)
  12190. CRYSTAL BBS, +49.7152.240-86.  14.4  HST Leonberg, BW, Germany.   Fido
  12191.   2:2407/3, LinuxNet
  12192. Echoblaster BBS  #1,   +49.7142.213-92.     HST/V32b  Bietigheim,  BW,
  12193.   Germany.  Fido 2:2407/4, LinuxNet (7-19,23-01h
  12194. Echoblaster BBS #2,  +49.7142.212-35.   V32b Bietigheim, BW,  Germany.
  12195.   Fido 2:2407/40, LinuxNet (20h-6h)
  12196. LinuxServer / P.  Berger, +49.711.756-275.   16.8  HST Stuttgart,  BW,
  12197.   Germany.  Fido 2:2407/34, LinuxNet (8:3-17:5,19-2)
  12198. Rising Sun BBS,  +49.7147.3845.   16.8 ZYX  Sachsenheim, BW,  Germany.
  12199.   Fido 2:2407/41, LinuxNet (5:30-2:30)
  12200. bakunin.north.de, +49.421.870-532.  14.4  D 2800 Bremen, HB,  Germany.
  12201.   kraehe@bakunin.north.de
  12202. oytix.north.de,    +49.421.396-57-62.           ZYX    HB,    Germany.
  12203.   mike@oytix.north.de, login as gast
  12204. Fiffis Inn BBS, +49-89-5701353.   14.4-19.2 Munich, Germany.   FidoNet
  12205.   2:246/69,Internet,USENET,LinuxNet
  12206. The Field  of  Inverse Chaos,  +358  0 506  1836.    14.4k  v32bis/HST
  12207.   Helsinki, Finland.  USENET; ichaos.nullnet.fi
  12208. Modula BBS, +33-1 4043 0124.  HST 14.4 v.32bis Paris, France.
  12209. Modula BBS, +33-1 4530 1248.  HST 14.4 V.32bis Paris, France.
  12210. STDIN BBS, +33-72375139.  v.32bis Lyon, Laurent Cas, France.   FidoNet
  12211. D.2.   Outside of the United States                                226
  12212. _______________________________________________________________________
  12213.  
  12214.   2:323/8
  12215. Le Lien, +33-72089879.  HST 14.4/V32bis Lyon, Pascal  Valette, France.
  12216.   FidoNet 2:323/5
  12217. Basil, +33-1-44670844.  v.32bis Paris, Laurent Chemla, France.
  12218. Cafard Naum, +33-51701632.  v.32bis Nantes, Yann Dupont, France.
  12219. DUBBS, +353-1-6789000.  19.2 ZyXEL Dublin, Ireland.  Fidonet 2:263/167
  12220. Galway Online,  +353-91-27454.   14.4k v32b  Galway, Ireland.    RIME,
  12221.   @iol.ie
  12222. Nemesis' Dungeon,  +353-1-324755  or 326900.    14.4k  v32bis  Dublin,
  12223.   Ireland.  Fidonet 2:263/150
  12224. nonsolosoftware, +39 51  6140772.   v.32bis, v.42bis  Italy.   Fidonet
  12225.   2:332/407
  12226. nonsolosoftware, +39 51 432904.  ZyXEL 19.2k Italy.  Fidonet 2:332/417
  12227. Advanced Systems, +64-9-379-3365.  ZyXEL 16.8k Auckland,  New Zealand.
  12228.   Singet, INTLnet, Fidonet
  12229. Thunderball Cave, 472567018.    Norway.  RIME ->CAVE
  12230. DownTown BBS Lelystad, +31-3200-48852.   14.4k Lelystad,  Netherlands.
  12231.   Fido 2:512/155, UUCP
  12232. MUGNET Intl-Cistron  BBS,  +31-1720-42580.    38.4k Alphen  a/d  Rijn,
  12233.   Netherlands.  UUCP
  12234. The Controversy, (65)560-6040.  14.4k V.32bis/HST Singapore.   Fidonet
  12235.   6:600/201
  12236. Pats System,  +27-12-333-2049.    14.4k  v.32bis/HST  Pretoria,  South
  12237.   Africa.  Fidonet 5:71-1/36
  12238. Gunship BBS, +46-31-693306.  14.4k HST DS Gothenburg Sweden.
  12239. Baboon BBS, +41-62-511726.   19.2k  Switzerland.   Fido 2:301/580  and
  12240.   /581
  12241. The Purple Tentacle, +44-734-590990.  HST/V32bis Reading,  UK. Fidonet
  12242.   2:252/305
  12243. A6 BBS, +44-582-460273.  14.4k Herts, UK. Fidonet 2:440/111
  12244. On the  Beach, +444-273-600996.    14.4k/16.8k Brighton,  UK.  Fidonet
  12245.   2:441/122
  12246.  
  12247.  
  12248.  
  12249.  
  12250.  
  12251.  
  12252.  
  12253.  
  12254. Appendix E
  12255.  
  12256.  
  12257.  
  12258.  
  12259. The GNU General Public License
  12260.  
  12261.  
  12262.  
  12263. Printed below is the GNU General Public License (the GPL or copyleft),
  12264. under which Linux  is licensed.   It  is reproduced  here to clear  up
  12265. some of the  confusion about Linux's  copyright status---Linux is  not
  12266. shareware, and it is not in the public domain.  The bulk  of the Linux
  12267. kernel is copyright Oc1993 by Linus  Torvalds, and other software  and
  12268. parts of the kernel are copyrighted by their authors.   Thus, Linux is
  12269. copyrighted, however, you may redistribute  it under the terms  of the
  12270. GPL printed below.
  12271.  
  12272.  
  12273.                       GNU GENERAL PUBLIC LICENSE
  12274.                          Version 2, June 1991
  12275.   Copyright cO1989, 1991 Free Software Foundation, Inc.  675 Mass Ave,
  12276. Cambridge, MA 02139, USA Everyone is permitted to copy  and distribute
  12277. verbatim copies  of this  license  document, but  changing  it is  not
  12278. allowed.
  12279.  
  12280. E.1 Preamble
  12281.  
  12282. The licenses for most software are designed to take away  your freedom
  12283. to share  and  change  it.    By  contrast,  the  GNU  General  Public
  12284. License is  intended to  guarantee your  freedom to  share and  change
  12285. free software--to make sure  the software is  free for all its  users.
  12286. This General  Public License  applies  to most  of the  Free  Software
  12287. Foundation's software and to any other program whose authors commit to
  12288. using it.  (Some other Free Software Foundation software is covered by
  12289. the GNU Library General Public License instead.)  You can  apply it to
  12290. your programs, too.
  12291.   When we  speak of free  software, we are  referring to freedom,  not
  12292. price.  Our General Public Licenses are designed to make sure that you
  12293. have the freedom to distribute copies of free software (and charge for
  12294. this service if you wish), that you receive source code or  can get it
  12295. if you want it, that you can  change the software or use pieces  of it
  12296. in new free programs; and that you know you can do these things.
  12297.   To protect  your rights,  we need to  make restrictions that  forbid
  12298.  
  12299.  
  12300.                                  227
  12301. E.2.Terms and Conditions for Copying, Distribution, and Modification228
  12302. _______________________________________________________________________
  12303.  
  12304. anyone to deny you these rights or to ask you to surrender the rights.
  12305. These restrictions translate  to certain  responsibilities for you  if
  12306. you distribute copies of the software, or if you modify it.
  12307.   For example,  if you distribute  copies of  such a program,  whether
  12308. gratis or for a fee, you must give the recipients all  the rights that
  12309. you have.  You must make  sure that they, too, receive or can  get the
  12310. source code.  And  you must show them  these terms so they know  their
  12311. rights.
  12312.   We protect your rights with two steps:   (1) copyright the software,
  12313. and (2) offer  you this license  which gives  you legal permission  to
  12314. copy, distribute and/or modify the software.
  12315.   Also,  for  each author's  protection  and  ours, we  want  to  make
  12316. certain that everyone understands that  there is no warranty for  this
  12317. free software.  If the software is modified by someone else and passed
  12318. on, we want  its recipients  to know that  what they  have is not  the
  12319. original, so that any problems  introduced by others will  not reflect
  12320. on the original authors' reputations.
  12321.   Finally,  any  free program  is  threatened constantly  by  software
  12322. patents.  We wish  to avoid the danger  that redistributors of a  free
  12323. program will individually obtain patent licenses, in effect making the
  12324. program proprietary.  To prevent this, we have made it  clear that any
  12325. patent must be  licensed for everyone's  free use  or not licensed  at
  12326. all.
  12327.   The  precise terms  and  conditions for  copying,  distribution  and
  12328. modification follow.
  12329.  
  12330.  
  12331. E.2 Terms and Conditions for Copying, Distribution, and Modification
  12332.  
  12333. 0.  This License applies to any  program or other work  which contains
  12334.     a  notice  placed  by  the  copyright  holder  saying  it  may  be
  12335.     distributed under the terms of  this General Public License.   The
  12336.     ``Program'', below,  refers  to  any  such program  or  work,  and
  12337.     a ``work  based  on the  Program''  means  either the  Program  or
  12338.     any derivative  work under  copyright  law:   that  is to  say,  a
  12339.     work containing the Program  or a portion  of it, either  verbatim
  12340.     or with  modifications and/or  translated  into another  language.
  12341.     (Hereinafter, translation  is included without  limitation in  the
  12342.     term ``modification''.)  Each licensee is addressed as ``you''.
  12343.  
  12344.     Activities other than copying,  distribution and modification  are
  12345.     not covered by this License; they are outside its scope.   The act
  12346.     of running the Program is not restricted, and the  output from the
  12347.     Program is covered  only if its contents  constitute a work  based
  12348.     on the Program  (independent of  having been made  by running  the
  12349.     Program).  Whether that is true depends on what the Program does.
  12350.  
  12351. 1.  You may  copy  and distribute  verbatim  copies of  the  Program's
  12352.     source code  as  you receive  it,  in  any medium,  provided  that
  12353.     you conspicuously  and  appropriately  publish  on  each  copy  an
  12354.     appropriate copyright  notice  and disclaimer  of  warranty;  keep
  12355. E.2.Terms and Conditions for Copying, Distribution, and Modification229
  12356. _______________________________________________________________________
  12357.  
  12358.     intact all  the notices  that refer  to this  License  and to  the
  12359.     absence of  any warranty;  and give  any other  recipients of  the
  12360.     Program a copy of this License along with the Program.
  12361.  
  12362.     You may charge a fee for the physical act of  transferring a copy,
  12363.     and you may at your  option offer warranty protection  in exchange
  12364.     for a fee.
  12365.  
  12366. 2.  You may modify your copy or  copies of the Program or  any portion
  12367.     of it, thus  forming a  work based  on the Program,  and copy  and
  12368.     distribute such modifications or work under the terms of Section 1
  12369.     above, provided that you also meet all of these conditions:
  12370.  
  12371.  
  12372.     a.  You must cause the  modified files to carry prominent  notices
  12373.         stating that you changed the files and the date of any change.
  12374.  
  12375.     b.  You must cause any work  that you distribute or publish,  that
  12376.         in whole or in part contains or is derived from the Program or
  12377.         any part thereof, to  be licensed as a  whole at no charge  to
  12378.         all third parties under the terms of this License.
  12379.  
  12380.     c.  If the modified program normally reads  commands interactively
  12381.         when run, you  must cause  it, when  started running for  such
  12382.         interactive use in the most ordinary way, to  print or display
  12383.         an announcement including an appropriate copyright  notice and
  12384.         a notice  that there  is  no warranty  (or else,  saying  that
  12385.         you provide a  warranty) and that  users may redistribute  the
  12386.         program under these  conditions, and telling  the user how  to
  12387.         view a copy  of this  License.   (Exception:   if the  Program
  12388.         itself is  interactive but  does not  normally  print such  an
  12389.         announcement, your work based  on the Program is not  required
  12390.         to print an announcement.)
  12391.  
  12392.  
  12393.     These requirements apply  to the  modified work  as a whole.    If
  12394.     identifiable sections  of  that  work  are not  derived  from  the
  12395.     Program, and can be reasonably considered independent and separate
  12396.     works in  themselves, then  this License,  and its  terms, do  not
  12397.     apply to  those  sections when  you  distribute them  as  separate
  12398.     works.   But when you distribute  the same sections  as part of  a
  12399.     whole which is a  work based on  the Program, the distribution  of
  12400.     the whole must be on the terms of this License,  whose permissions
  12401.     for other licensees extend to  the entire whole, and thus  to each
  12402.     and every part regardless of who wrote it.
  12403.  
  12404.     Thus, it is  not the  intent of  this section to  claim rights  or
  12405.     contest your rights to work  written entirely by you; rather,  the
  12406.     intent is to  exercise the  right to control  the distribution  of
  12407.     derivative or collective works based on the Program.
  12408. E.2.Terms and Conditions for Copying, Distribution, and Modification230
  12409. _______________________________________________________________________
  12410.  
  12411.     In addition, mere  aggregation of  another work  not based on  the
  12412.     Program with the Program (or with a work based on  the Program) on
  12413.     a volume of a  storage or distribution  medium does not bring  the
  12414.     other work under the scope of this License.
  12415.  
  12416. 3.  You may copy and  distribute the Program (or  a work based on  it,
  12417.     under Section 2) in object code or executable form under the terms
  12418.     of Sections 1  and 2 above provided  that you also  do one of  the
  12419.     following:
  12420.  
  12421.  
  12422.     a.  Accompany it with the complete  corresponding machine-readable
  12423.         source code,  which must  be  distributed under  the terms  of
  12424.         Sections 1  and  2 above  on  a  medium customarily  used  for
  12425.         software interchange; or,
  12426.  
  12427.     b.  Accompany it with  a written offer,  valid for at least  three
  12428.         years, to give any third party, for a charge no more than your
  12429.         cost of physically performing source distribution,  a complete
  12430.         machine-readable copy of the corresponding source code,  to be
  12431.         distributed under the  terms of Sections  1 and  2 above on  a
  12432.         medium customarily used for software interchange; or,
  12433.  
  12434.     c.  Accompany it with the information you received as to the offer
  12435.         to distribute corresponding source code.  (This alternative is
  12436.         allowed only for  noncommercial distribution  and only if  you
  12437.         received the program  in object code  or executable form  with
  12438.         such an offer, in accord with Subsection b above.)
  12439.  
  12440.  
  12441.     The source code for  a work means the  preferred form of the  work
  12442.     for making modifications to it.  For an executable  work, complete
  12443.     source code means all the source code for all modules it contains,
  12444.     plus any associated interface  definition files, plus the  scripts
  12445.     used to control  compilation and  installation of the  executable.
  12446.     However, as  a  special  exception,  the source  code  distributed
  12447.     need not include anything that is normally distributed  (in either
  12448.     source or  binary  form)  with  the  major  components  (compiler,
  12449.     kernel, and so on) of the operating system on which the executable
  12450.     runs, unless that component itself accompanies the executable.
  12451.  
  12452.     If distribution of executable or  object code is made  by offering
  12453.     access to copy from a  designated place, then offering  equivalent
  12454.     access to  copy the  source code  from the  same  place counts  as
  12455.     distribution of the source code, even though third parties are not
  12456.     compelled to copy the source along with the object code.
  12457.  
  12458. 4.  You may not  copy, modify, sublicense,  or distribute the  Program
  12459.     except as  expressly provided  under this  License.   Any  attempt
  12460.     otherwise to copy,  modify, sublicense  or distribute the  Program
  12461. E.2.Terms and Conditions for Copying, Distribution, and Modification231
  12462. _______________________________________________________________________
  12463.  
  12464.     is void,   and will  automatically  terminate  your  rights  under
  12465.     this License.    However,  parties who  have received  copies,  or
  12466.     rights, from you under this  License will not have  their licenses
  12467.     terminated so long as such parties remain in full compliance.
  12468.  
  12469. 5.  You are  not  required to  accept  this License,  since  you  have
  12470.     not signed it.   However,  nothing else  grants you permission  to
  12471.     modify or distribute the Program  or its derivative works.   These
  12472.     actions are prohibited by law  if you do not accept  this License.
  12473.     Therefore, by modifying or  distributing the Program (or any  work
  12474.     based on  the  Program),  you  indicate your  acceptance  of  this
  12475.     License to do so,  and all its  terms and conditions for  copying,
  12476.     distributing or modifying the Program or works based on it.
  12477.  
  12478. 6.  Each time  you redistribute  the  Program (or  any work  based  on
  12479.     the Program), the recipient automatically receives a  license from
  12480.     the original licensor  to copy, distribute  or modify the  Program
  12481.     subject to these  terms and conditions.   You  may not impose  any
  12482.     further restrictions  on the  recipients' exercise  of the  rights
  12483.     granted herein.  You are not responsible for  enforcing compliance
  12484.     by third parties to this License.
  12485.  
  12486. 7.  If, as a consequence of  a court judgment or allegation  of patent
  12487.     infringement or  for  any  other  reason (not  limited  to  patent
  12488.     issues), conditions are  imposed on you  (whether by court  order,
  12489.     agreement or  otherwise) that  contradict the  conditions of  this
  12490.     License, they  do  not  excuse you  from  the conditions  of  this
  12491.     License.  If you cannot distribute so as to satisfy simultaneously
  12492.     your obligations  under  this  License  and  any  other  pertinent
  12493.     obligations, then  as a  consequence you  may  not distribute  the
  12494.     Program at  all.   For  example,  if a  patent  license would  not
  12495.     permit royalty-free redistribution of the Program by all those who
  12496.     receive copies directly or indirectly  through you, then the  only
  12497.     way you could satisfy both it and this License would be to refrain
  12498.     entirely from distribution of the Program.
  12499.  
  12500.     If any portion  of this section is  held invalid or  unenforceable
  12501.     under any particular circumstance,  the balance of the section  is
  12502.     intended to apply and the section as a whole is  intended to apply
  12503.     in other circumstances.
  12504.  
  12505.     It  is  not  the  purpose  of  this  section  to   induce  you  to
  12506.     infringe any patents or other property right claims or  to contest
  12507.     validity of any  such claims;  this section  has the sole  purpose
  12508.     of protecting  the integrity  of  the free  software  distribution
  12509.     system, which is  implemented by public license  practices.   Many
  12510.     people have  made  generous contributions  to  the wide  range  of
  12511.     software distributed through that system in reliance on consistent
  12512.     application of that system; it is up to the author/donor to decide
  12513.     if he or she is  willing to distribute software through  any other
  12514. E.2.Terms and Conditions for Copying, Distribution, and Modification232
  12515. _______________________________________________________________________
  12516.  
  12517.     system and a licensee cannot impose that choice.
  12518.  
  12519.     This section is intended to make thoroughly clear what is believed
  12520.     to be a consequence of the rest of this License.
  12521.  
  12522. 8.  If the distribution  and/or use  of the Program  is restricted  in
  12523.     certain countries either by patents or by  copyrighted interfaces,
  12524.     the original copyright  holder who places  the Program under  this
  12525.     License may add an  explicit geographical distribution  limitation
  12526.     excluding those countries, so that distribution is  permitted only
  12527.     in or  among countries  not thus  excluded.   In  such case,  this
  12528.     License incorporates the limitation as  if written in the  body of
  12529.     this License.
  12530.  
  12531. 9.  The Free  Software  Foundation  may  publish  revised  and/or  new
  12532.     versions of the General  Public License from time  to time.   Such
  12533.     new versions will be similar in spirit to the present version, but
  12534.     may differ in detail to address new problems or concerns.
  12535.  
  12536.     Each version is  given a distinguishing  version number.   If  the
  12537.     Program specifies a version  number of this License which  applies
  12538.     to it and ``any later version'', you have the  option of following
  12539.     the terms and conditions  either of that  version or of any  later
  12540.     version published by the Free Software Foundation.  If the Program
  12541.     does not specify a version number of this License,  you may choose
  12542.     any version ever published by the Free Software Foundation.
  12543.  
  12544. 10. If you wish to  incorporate parts of  the Program into other  free
  12545.     programs whose distribution conditions are different, write to the
  12546.     author to ask for permission.   For software which  is copyrighted
  12547.     by the  Free  Software  Foundation,  write to  the  Free  Software
  12548.     Foundation; we sometimes make exceptions  for this.   Our decision
  12549.     will be guided by the two  goals of preserving the free  status of
  12550.     all derivatives of our free software and of promoting  the sharing
  12551.     and reuse of software generally.
  12552.  
  12553.  
  12554.                              NO WARRANTY
  12555.  
  12556. 11. BECAUSE THE  PROGRAM  IS LICENSED  FREE  OF  CHARGE, THERE  IS  NO
  12557.     WARRANTY FOR THE  PROGRAM, TO THE  EXTENT PERMITTED BY  APPLICABLE
  12558.     LAW.  EXCEPT  WHEN  OTHERWISE  STATED  IN  WRITING  THE  COPYRIGHT
  12559.     HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
  12560.     WARRANTY OF  ANY KIND,  EITHER  EXPRESSED OR  IMPLIED,  INCLUDING,
  12561.     BUT NOT  LIMITED TO,  THE  IMPLIED WARRANTIES  OF  MERCHANTABILITY
  12562.     AND FITNESS FOR A  PARTICULAR PURPOSE. THE  ENTIRE RISK AS TO  THE
  12563.     QUALITY AND PERFORMANCE  OF THE  PROGRAM IS WITH  YOU. SHOULD  THE
  12564.     PROGRAM PROVE  DEFECTIVE, YOU  ASSUME THE  COST  OF ALL  NECESSARY
  12565.     SERVICING, REPAIR OR CORRECTION.
  12566. E.3.   Appendix:  How to Apply These Terms to Your New Programs    233
  12567. _______________________________________________________________________
  12568.  
  12569. 12. IN NO  EVENT  UNLESS  REQUIRED  BY APPLICABLE  LAW  OR  AGREED  TO
  12570.     IN WRITING  WILL ANY  COPYRIGHT  HOLDER, OR  ANY OTHER  PARTY  WHO
  12571.     MAY MODIFY  AND/OR REDISTRIBUTE  THE PROGRAM  AS PERMITTED  ABOVE,
  12572.     BE LIABLE  TO YOU  FOR DAMAGES,  INCLUDING  ANY GENERAL,  SPECIAL,
  12573.     INCIDENTAL OR  CONSEQUENTIAL DAMAGES  ARISING OUT  OF  THE USE  OR
  12574.     INABILITY TO USE  THE PROGRAM (INCLUDING BUT  NOT LIMITED TO  LOSS
  12575.     OF DATA OR DATA BEING  RENDERED INACCURATE OR LOSSES  SUSTAINED BY
  12576.     YOU OR THIRD PARTIES OR A  FAILURE OF THE PROGRAM TO  OPERATE WITH
  12577.     ANY OTHER PROGRAMS), EVEN IF  SUCH HOLDER OR OTHER PARTY  HAS BEEN
  12578.     ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  12579.  
  12580.                      END OF TERMS AND CONDITIONS
  12581.  
  12582.  
  12583. E.3 Appendix:  How to Apply These Terms to Your New Programs
  12584.  
  12585. If you develop a new  program, and you want  it to be of the  greatest
  12586. possible use to the public, the best way to achieve this is to make it
  12587. free software which everyone can  redistribute and change under  these
  12588. terms.
  12589.   To do  so,  attach the  following notices  to the  program.   It  is
  12590. safest to  attach  them to  the  start of  each  source file  to  most
  12591. effectively convey the  exclusion of  warranty; and  each file  should
  12592. have at least the ``copyright'' line  and a pointer to where  the full
  12593. notice is found.
  12594.  
  12595.     <one line to give the program's name and  a brief idea of what
  12596.     it does.> Copyright cO19yy <name of author>
  12597.  
  12598.     This program is free software; you can redistribute  it and/or
  12599.     modify it under the terms of the GNU General Public License as
  12600.     published by the Free Software Foundation; either version 2 of
  12601.     the License, or (at your option) any later version.
  12602.  
  12603.     This program  is  distributed in  the  hope  that it  will  be
  12604.     useful, but  WITHOUT ANY  WARRANTY; without  even the  implied
  12605.     warranty  of  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR
  12606.     PURPOSE. See the GNU General Public License for more details.
  12607.  
  12608.     You should  have received  a copy  of the  GNU General  Public
  12609.     License along with  this program;  if not,  write to the  Free
  12610.     Software Foundation, Inc., 675 Mass Ave, Cambridge,  MA 02139,
  12611.     USA.
  12612.  
  12613.   Also add information on  how to contact you by electronic  and paper
  12614. mail.
  12615.   If the program  is interactive, make it  output a short notice  like
  12616. this when it starts in an interactive mode:
  12617.  
  12618.     Gnomovision version  69,  Copyright (C)  19yy name  of  author
  12619. E.3.   Appendix:  How to Apply These Terms to Your New Programs    234
  12620. _______________________________________________________________________
  12621.  
  12622.     Gnomovision comes  with ABSOLUTELY  NO WARRANTY;  for  details
  12623.     type `show w'.   This  is free software,  and you are  welcome
  12624.     to redistribute it under certain conditions; type `show c' for
  12625.     details.
  12626.  
  12627.   The hypothetical  commands `show  w' and  `show c'  should show  the
  12628. appropriate parts  of the  General Public  License.   Of  course,  the
  12629. commands you use may be called something other than `show w' and `show
  12630. c'; they could even be mouse-clicks or menu items--whatever suits your
  12631. program.
  12632.   You should  also get  your employer  (if you work  as a  programmer)
  12633. or your school,  if any,  to sign a  ``copyright disclaimer'' for  the
  12634. program, if necessary.  Here is a sample; alter the names:
  12635.  
  12636.     Yoyodyne, Inc.,  hereby disclaims  all  copyright interest  in
  12637.     the program `Gnomovision'  (which makes  passes at  compilers)
  12638.     written by James Hacker.
  12639.  
  12640.     <signature of Ty Coon>, 1 April 1989
  12641.     Ty Coon, President of Vice
  12642.  
  12643.  
  12644.   This  General Public  License  does  not permit  incorporating  your
  12645. program into proprietary programs.   If  your program is a  subroutine
  12646. library, you may consider it more useful to permit linking proprietary
  12647. applications with the library.   If this is  what you want to do,  use
  12648. the GNU Library General Public License instead of this License.
  12649.  
  12650.  
  12651.  
  12652.  
  12653.  
  12654.  
  12655. Index
  12656.  
  12657.  
  12658.  
  12659. *, 106                               /proc, 102
  12660. - to begin command options, 98           mounting of, 157
  12661. .bash_profile, 135                   /sbin, 102
  12662. .bashrc, 135                         /tmp, 102
  12663. .profile, 135                        /usr, 102
  12664. .tcshrc, 135                         /usr/X11R6/lib/X11/XF86Config,
  12665. /                                           171
  12666.    in pathnames, 90                  /usr/X386, 103
  12667.    root directory name, 90           /usr/etc, 103
  12668. /Image, 141                          /urs/g++-include, 103
  12669. /bin/bash, 105                       /usr/include, 103
  12670. /bin/csh, 105                        /usr/lib, 103
  12671. /bin/sh, 105                         /usr/local, 104
  12672. /bin/tcsh, 105                       /usr/man, 104
  12673. /dev/console, 101                    /usr/src, 104
  12674. /dev/cua, 101                        /var, 104
  12675. /dev/hd, 101                         /var/adm, 104
  12676. /dev/lp, 101                         /var spool, 104
  12677. /dev/null, 101                       /vmlinux, 141
  12678. /dev/pty, 102                        /zImage, 141
  12679. /dev/tty, 102                        <, 110
  12680. /dev/ttyS, 101                       >, 109
  12681. /etc, 102                            ?, 107
  12682. /etc/Image, 141                      ~
  12683. csh.login, 135                           to refer  to home  directory,
  12684. /etc/fstab, 157                             92
  12685. /etc/getty, 160                      386BSD, 26
  12686. /etc/group
  12687.    format of, 147                    account
  12688. /etc/host.conf, 193                      creating, 86
  12689. /etc/hosts, 192                      addgroup, 147
  12690. /etc/init, 160                       adding users, 144
  12691. /etc/inittab, 160                        with adduser, 146
  12692. /etc/networks, 192                       with useradd, 146
  12693. /etc/passwd, 145                     adduser, 146
  12694. /etc/profile, 135                    afio, 151
  12695. /etc/rc, 160                         alpha, 20
  12696. /etc/rc.local, 160                   archiving files, 147--150
  12697. /etc/resolve.conf, 193               argument
  12698. /etc/zImage, 141                         command
  12699. /home, 102                                defined, 88
  12700. /lib, 102                            backflops, 151
  12701.  
  12702.  
  12703.                                  235
  12704. INDEX                                                              236
  12705. _______________________________________________________________________
  12706.  
  12707. background process, 118                  grouping with shell  scripts,
  12708. backgrounding jobs, 120                     131
  12709. backups, 151                             summary of basic, 98--100
  12710.    incremental, 151                  commercial support, 37
  12711.    multi-volume, 151                 compress, 149
  12712.    to floppy disk, 151               compressing files, 147--150
  12713. bash, 105                            configuration scripts
  12714. BBS list, 222--226                       for TCP/IP, 189
  12715. BBS software, 15                     console
  12716.    FidoNet, 15                           defined, 87
  12717. beta, 21                                 device name for, 101
  12718. bg, 122                                  virtual, 87
  12719. /bin, 100                            copy files, 96
  12720. books, 206--210                      copying   Linux,   18--19,    26,
  12721. boot floppy, 69--70, 162                    227--234
  12722.    creating, 141                     copyright, 18--19, 227--234
  12723. boot scripts, 160                    core dumps, 6
  12724. booting, 56, 141--143                cp, 96, 99
  12725.    from maintenance floppy, 162      csh, 8
  12726.    problems, 72--74, 81, 82          current working directory
  12727.    with LILO, 142--143                   defined, 90
  12728. booting Linux
  12729.    with boot floppy, 141             databases, 17
  12730. booting non-Linux systems, 142       debugging
  12731. Bourne again shell, 105                  core dumps, 6
  12732. Bourne shell, 8, 105                 delete
  12733. broadcast address                        directory, 97
  12734.    defined, 188                          files, 96
  12735. bugs, 20                             deleting users, 146
  12736.                                      deluser, 146
  12737. C News, 200                          /dev, 101
  12738. C Shell (csh), 8, 105                /dev/sd, 101
  12739. cat, 100                             /dev/sr, 101
  12740.    to view file contents, 97         /dev/st, 101
  12741. cd, 92--93, 98                       development
  12742. chfn, 146                                alpha, 20
  12743. chmod, 115                               beta, 21
  12744. chsh, 146                                conventions, 21
  12745. client                               device driver, 101
  12746.    news                              devices
  12747.     defined, 200                         /dev/console, 101
  12748. Coherent, 27                             /dev/cua, 101
  12749. command                                  /dev/hd, 101
  12750.    argument                              /dev/lp, 101
  12751.     defined, 88                          /dev/null, 101
  12752.    defined, 88                           /dev/pty, 102
  12753. command not found error message,         /dev/sd, 101
  12754.       88                                 /dev/sr, 101
  12755. commands                                 /dev/st, 101
  12756.    - to begin options, 98                /dev/tty, 102
  12757. INDEX                                                              237
  12758. _______________________________________________________________________
  12759.  
  12760.    /dev/ttyS, 101                        nesting, 90
  12761.    accessing, 101                        parent, 90
  12762.    console, 101                           ..  to refer to, 93
  12763.    fd, 101                               permisions
  12764.    floppy disk, 101                       execute, 113
  12765.    hard drives, 101                       read, 113
  12766.    null, 101                              write, 113
  12767.    parallel ports, 101                   permissions
  12768.    pseudo-terminals, 102                  changing, 115
  12769.    SCSI, 101                              dependencies of, 114
  12770.    serial ports, 101                     root
  12771.    virtual consoles, 102                  defined, 90
  12772. dip, 194                                 structure, 90
  12773.    chat script for, 197--199              moving  around  in with  cd,
  12774.    connecting  to  SLIP   server            92
  12775.       with, 197--199                     tree, 90
  12776.    dynamic IP address with, 196          working
  12777.    static IP address with, 195            defined, 90
  12778. directory                            disabling users, 146
  12779.    .  to refer to, 93                disasters
  12780.    /etc, 102                             recovery from, 162--164
  12781.    /home, 102                             with   maintenance   floppy,
  12782.    /lib, 102                                162
  12783.    /proc, 102                        distributions, 21, 40--50
  12784.    /sbin, 102                            Internet, getting  from  the,
  12785.    /tmp, 102                                41
  12786.    /usr, 102                             list, 211--213
  12787.    /usr/X386, 103                        mail order, 42
  12788.    /usr/bin, 103                         online sources, 42
  12789.    /usr/etc, 103                     documentation, 203--210
  12790.    /urs/g++-include, 103                 books, 33, 206--210
  12791.    /usr/include, 103                     Frequently  Asked  Questions,
  12792.    /usr/lib, 103                            203
  12793.    /usr/local, 104                       HOWTO documents, 204
  12794.    /usr/man, 104                         info files, 9
  12795.    /usr/src, 104                         Linux Documentation  Project,
  12796.    /var, 104                                33, 205--206
  12797.    /var/adm, 104                         Linux Software Map, 17
  12798.    /var spool, 104                       online, 32, 203--205
  12799.    /bin, 100                              FAQ, 33
  12800.    creating, 95                           HOWTO documents, 33
  12801.    current working                       texinfo, 9
  12802.     defined, 90                      Doom, 17
  12803.    defined, 89
  12804.    delete, 97                        e-mail, 200
  12805.    /dev, 101                             mailer
  12806.    home                                   defined, 200
  12807.     ~ to refer to, 92                    transport
  12808.     defined, 90                           defined, 200
  12809.    listing contents of, 93--95       e2fsck, 158, 163
  12810. INDEX                                                              238
  12811. _______________________________________________________________________
  12812.  
  12813. echo, 100                                backing up, 151
  12814. editor                                   compressing, 147--150
  12815.    defined, 123                          defined, 89
  12816. editors, 7                               device, 101
  12817. efsck, 159                               hidden
  12818. elm, 200                                  not  matched  by  wildcards,
  12819. Emacs, 7, 123                               107
  12820. emergencies                              inode numbers of, 115
  12821.    recovery from, 162--164               links, 115--117
  12822.     with   maintenance   floppy,         listing, 93--95
  12823.       162                                listing permissions  of  with
  12824. end-of-text signal, 109                     ls, 113
  12825. environment                              MS-DOS, 184
  12826.    customizing, 130--135                 owership of by group, 112
  12827.    variables                             owership of by user, 112
  12828.     PATH, 134                            permisions
  12829. EOT (end of text) signal, 109             execute, 113
  12830. error messages                            read, 113
  12831.    error messages                         write, 113
  12832.     command not found, 88                permissions
  12833. ethernet, 14                              changing, 115
  12834.    supported cards, 186                   defined, 112
  12835. executable                                dependencies of, 114
  12836.    defined, 94                            group, 147
  12837. executables, 6                            interpreting, 113
  12838. exit, 89                                 permissions of, 112--115
  12839. export, 133                              recovering, 164
  12840.                                          viewing contents of, 97
  12841. FAQ, 33                              filesystem
  12842. fdisk, 55, 60--63                        exploring, 100--104
  12843.    under MS-DOS, 55                  filesystems, 5, 52, 53, 156--159
  12844. features                                 /etc/fstab, 157
  12845.    kernel, 5--6                          checking, 158
  12846.    system, 5--6                          creating, 64--65
  12847. fg, 122                                  fixing corrupted, 163
  12848. FidoNet, 15                              mounting, 156--158
  12849. file                                     on floppy disk, 151
  12850.    copy, 96                              root, 52
  12851.    delete, 96                            unmounting, 158
  12852.    executable                             unmounting with  shutdown or
  12853.     defined, 94                             halt, 158
  12854.    move, 96                          filter
  12855. filename                                 defined, 110
  12856.    defined, 89                       find
  12857. filenames                                for incremental backups, 151
  12858.    wildcard characters in, 106--     FIPS, 54
  12859.       108                            floating-point math, 5
  12860. files                                floppy disk
  12861.    appeding to, 112                      boot/root, 162
  12862.    archiving, 147--150                   device names for, 101
  12863. INDEX                                                              239
  12864. _______________________________________________________________________
  12865.  
  12866.    maintenance, 162                      device names for, 101
  12867.    unmounting, 152                   hardware
  12868. floppy disks                             problems, 74--79
  12869.    as backup medium, 151                  conflicts, 75--76
  12870.    file systems on, 151                   hard drive, 76--78
  12871. forground process, 118                    SCSI, 78--79
  12872. free software, 18                    hardware support, 27--32
  12873. Free  Software  Foundation,  18,         CD-ROM, 31
  12874.       227                                controller, 29
  12875. Frequently Asked Questions, 203          CPU, 28
  12876. fsck, 159, 163                           drive space, 29
  12877. FTP                                      ethernet cards, 31, 186
  12878.    anonymous, 41                         hard drive, 29
  12879.    archive site list, 220                memory, 28
  12880.    using, 214--220                       mice, 30
  12881. ftpmail, 220                             modems, 31
  12882. fullname                                 monitor, 30
  12883.    setting with chfn, 146                motherboard, 28
  12884. functionality, 22                        printers, 31
  12885.                                          SCSI, 29, 31
  12886. games, 17                                tape drives, 31
  12887.    Doom, 17                              video card, 30, 166
  12888. gateway address                      help
  12889.    defined, 188                          getting, 37--39
  12890. gcc                                      online, 97
  12891.    upgrading, 155                    home directory
  12892. gdb, 11                                  ~ to refer to, 92
  12893. General Public License,  18--19,         defined, 90, 145
  12894.       227--234                       hostname
  12895. getting help, 32                         hostname, 161
  12896. getty, 160                               defined, 86
  12897. GNU, 7                                   setting, 161, 193
  12898.    General Public License,  18--     hostname, 193
  12899.       19, 227--234                   HOWTO documents, 33, 204
  12900. gprof, 11                            HURD, 27
  12901. grep, 100
  12902. groff, 8                             ifconfig, 190
  12903. group ID                             inetd, 191
  12904.    defined, 144                      Ingres, 17
  12905. groupadd, 147                        init, 160
  12906. groups, 112, 147                     initialization files
  12907.    adding, 147                           for shells, 135
  12908.    deleting, 147                     initialization scripts
  12909. groups, 147                              for shells, 135
  12910. gzip, 149                            inittab, 160
  12911.                                      INN, 200
  12912. hacker, 20                           inode number
  12913. halt, 144                                defined, 115
  12914. hard drive                           input
  12915.    problems, 77                          redirecting, 110
  12916. hard drives
  12917. INDEX                                                              240
  12918. _______________________________________________________________________
  12919.  
  12920. installation, 40--84                 LaTeX, 8
  12921.    boot floppy, 69--70               libraries, 11
  12922.    booting Linux, 56                     fixing corrupted, 164
  12923.    LILO, 69--70                          shared, 6
  12924.    mke2fs, 64--65                        upgrading, 154
  12925.    mkswap, 63--64                    LILO, 69--70, 142--143
  12926.    other procedures, 70                  as boot loader, 142
  12927.    overview, 50--51                      installing, 142
  12928.    preparation, 50--56                   problems booting, 72
  12929.    problems, 71--84                      problems installing, 83
  12930.     booting, 72--74, 81, 82              selecting  default  operating
  12931.     errors, 79                              system for, 143
  12932.     file permissions, 84             links, 115--117
  12933.     hardware, 74--79                     display number of, 116
  12934.     LILO, 83                             hard, 115
  12935.     logging in, 83                       symbolic, 117
  12936.     media errors, 79                 Linux, 1--234
  12937.     postinstallation, 81--84             and cost, 26
  12938.    repartitioning, 52, 54--56            bugs, 20
  12939. Internet, 14, 41                         commercial support, 37
  12940.    mailing lists, 36                     copying, 26
  12941. IP address                               copyright, 18--19, 227--234
  12942.    defined, 187                          development, 20
  12943. IRQ, 75                                  distributions, 21
  12944.  
  12945. job                                      getting,h41istory, 3
  12946.    background, 118, 120, 122             installing, 40--84
  12947.     kill, 120                            philosophy, 19--23
  12948.    defined, 118                          pronunciation, 1
  12949.    forground, 118                        sources of information, 32
  12950.    interupt, 119                         stability, 26
  12951.    inturpting, 119                       system features, 5--6
  12952.    kill, 119                         Linux  Documentation Project, 33,
  12953.    restarting, 122                          205--206
  12954.    stopping, 121                     Linux Journal, 206
  12955.    suspended, 119                    Linux Software Map, 17, 204
  12956. job control, 5, 117--123             Linux-Activists mailing list, 36
  12957. jobs, 120                            listing  directory contents, 93--
  12958.                                          95
  12959. kernel                               logging in, 86
  12960.    compiling, 154                        problems, 83
  12961.    compiling  compressed  image,     logging out
  12962.       154                                with exit command, 89
  12963.    features, 5--6                    login, 86
  12964.    sources for, 153                  login name
  12965.    upgrading, 153                        defined, 86
  12966. kernel image                         login shell
  12967.    compressed, 141                       defined, 135, 145
  12968.    file name of, 141                     setting with chsh, 146
  12969. kill, 120                            ls, 93--95, 98
  12970. INDEX                                                              241
  12971. _______________________________________________________________________
  12972.  
  12973.    listing   file    permissions     nameserver address
  12974.       with, 113                          defined, 188
  12975.                                      NET-2, 185
  12976. mail order, 42                           support for  serial line  In-
  12977. mailer                                      ternet  protocol   (SLIP),
  12978.    for e-mail, 200                          185
  12979. mailers, 14                          NetBSD, 26
  12980. mailing lists, 36                    netstat, 194
  12981.    Linux-Activists, 36               network address
  12982. mailx, 200                               defined, 188
  12983. maintenance floppy, 162              network mask
  12984. man, 97, 99                              defined, 187
  12985. manual pages, 97                     networking, 5, 14--15
  12986. master boot record, 52                   and X Windows, 14
  12987. Mbase, 17                                ethernet  cards,   supported,
  12988. METAFONT, 11                                31, 186
  12989. Microsoft Windows, 16                    FTP, 14
  12990.    emulator, 185                         NET-2, 185
  12991. Minix, 3, 27                             news, 14, 200--202
  12992. mkdir, 95, 99                            NFS, 14, 191
  12993. mke2fs, 64--65                           NNTP, 14
  12994.    for floppy disk, 151                  PPP, 195
  12995. mkswap, 63--64, 159                      SLIP, 14, 185
  12996. money, 26                                TCP/IP, 185--199
  12997. more, 97, 99                             UUCP, 14, 199--200
  12998. Motif, 13                            news, 200--202
  12999. mount, 157                               client
  13000.    mounting  floppy  disk  with,          defined, 200
  13001.       151                                news readers
  13002.    to  mount  MS-DOS  partition,          defined, 200
  13003.       184                                 rn, 200
  13004. mount point                               rn, 200
  13005.    defined, 152                          server
  13006. move files, 96                            C News, 200
  13007. MS-DOS, 24--25                            defined, 200
  13008.    accessing files from, 16, 184          INN, 200
  13009.    emulator, 16, 184                     UUCP, 199
  13010.    mounting partion under Linux,     news readers, 14
  13011.       184                                defined, 200
  13012.    repartitioning, 55                NFS, 191
  13013.    running programs from  Linux,     null file, 101
  13014.       184
  13015.    using Mtools to access files,     operating sytems
  13016.       184                                booting non-Linux, 142, 143
  13017. multitasking, 5                      OS/2, 25
  13018.    defined, 86                       output
  13019. multiuser                                redirecting, 109
  13020.    defined, 86
  13021. mv, 96, 99                           parallel port
  13022.                                          device name for, 101
  13023. named, 192                           parent directory, 90
  13024. INDEX                                                              242
  13025. _______________________________________________________________________
  13026.  
  13027.    ..  to refer to, 93                   core dumps, 6
  13028. partition table, 52                      languages, 11
  13029. partitions, 52, 53                       libraries, 11
  13030.    fdisk, 55, 60--63                     UNIX, 12
  13031.    Linux, 58--60                         utilities, 11
  13032.    size, 54                          protected mode, 6
  13033. passwd, 89, 146                      ps, 118
  13034. password                             pseudo-terminals, 102
  13035.    changing with passwd, 89
  13036.    defined, 86                       RAWRITE.EXE, 41
  13037.    fixing root, 163                  rc, 160
  13038. password file                            files
  13039.    format of, 145                         defined, 189
  13040. pathname                                  for TCP/IP, 189
  13041.    absolute, 92                      rc.inet, 189
  13042.    defined, 89                       rc.inet1, 189
  13043.    full, 92                              sample, 190
  13044.    relative, 91                      rc.inet2, 189, 191
  13045. permissions                              sample, 191
  13046.    changing, 115                     rc.local, 160
  13047.    defined, 112                      rc.net, 189
  13048.    dependencies of, 114              rdev, 141
  13049.    execute, 113                      reading
  13050.    for shell scripts, 132                suggested, 206--210
  13051.    group, 147                        redirection
  13052.    interpreting, 113                     non-destructive, 112
  13053.    of files, 112--115                    standard input, 109
  13054.    problems, 84                          standard output, 109
  13055.    read, 113                         repartitioning, 54--56
  13056.    write, 113                            concepts, 52
  13057. pipelining                               fdisk, 55
  13058.    defined, 111                           under MS-DOS, 55
  13059. pipes                                    FIPS, 54
  13060.    creating, 111                     rm, 96, 99
  13061.    using, 110--112                   rmdir, 97, 99
  13062. POSIX.1, 5                           rn, 200
  13063. Postgres, 17                         root
  13064. PPP, 5, 195                              fixing password for, 163
  13065. process                              root account, 137--139
  13066.    background, 118                       eithical issues, 139
  13067.     kill, 120                            privleges of, 138
  13068.    defined, 118                          using different  prompt  for,
  13069.    forground, 118                           138
  13070.    ID                                root device
  13071.     defined, 118                         setting name  of  with  rdev,
  13072.    interupt, 119                            141
  13073.    interupting, 119                  root directory
  13074.    kill, 119                             defined, 90
  13075.    ps to list, 118                   root filesystem, 52
  13076. programming, 11--12                  route, 190
  13077. INDEX                                                              243
  13078. _______________________________________________________________________
  13079.  
  13080.    entry  in  /etc/networks  re-         device names for, 196
  13081.       quired for, 192                    dynamic IP address with  dip,
  13082. routed, 191                                 196
  13083.                                          static IP  address with  dip,
  13084. scientific software, 17                     195
  13085. SCSI                                     static IP address with  slat-
  13086.    problems, 78--79                         tach, 196
  13087. SCSI devices                         Smail, 200
  13088.    names for, 101                    software, 6--17
  13089. security, 139                            bash, 8
  13090. sendmail, 200                            installing, 152--156
  13091. serial line  Internet  protocol,         tcsh, 8
  13092.       185, 194--199                      upgrading, 152--156
  13093. serial ports                             where to find releases, 156
  13094.    device names for, 101             sound support, 17
  13095. setenv, 133                          sources of information, 203--210
  13096. Seyon, 15                            stability, 26
  13097. shareware, 18                        standard input, 108--112
  13098. shell script, 7                          redirecting, 110
  13099.    defined, 131                      standard output, 108--112
  13100. shell scripts                            redirecting, 109
  13101.    comments in, 132                  standards, 5
  13102.    defined, 105                      startup scripts, 160
  13103.    initializtion, 135                slattach
  13104.    permissions for, 132                  static IP addresses with, 196
  13105.    variables in, 132                 stdin, 108
  13106. shell variables                      stdout, 108
  13107.    exporting to environment, 133     superblock
  13108. shells, 7, 105                           defined, 163
  13109.    Bourne again shell, 105               fixing corrupted, 163
  13110.    Bourne shell, 105                 swap file, 53, 159--160
  13111.    C shell, 105                          deleting, 160
  13112.    defined, 87                       swap partition
  13113.    initializtion files, 135              in /etc/fstab, 157
  13114.    job control provided by, 117      swap space, 6, 53
  13115.    prompt, 88                            creating, 63--64
  13116.    variables                             creating temporary, 160
  13117.     defined, 132                     swapoff, 160
  13118.    wildcard characters for, 106-     swapon, 157, 159
  13119.       -108                           syslogd, 191
  13120.    wildcard expansion, 106           system administration
  13121. shutdown command, 71, 143                adding users, 144
  13122. shutting down, 143--144                  booting Linux, 141--143
  13123. Slackware                                duties, 140
  13124.    getting, 43--50                       security issues, 139
  13125.    installing, 66--69                    shutting down, 143--144
  13126. slattach, 194                        system security, 139
  13127. SLIP, 5, 14, 185, 194--199           system-defined accounts
  13128.    connecting  to  servier  with         root, 137
  13129.       dip, 197                       Tanenbaum, Andy, 3
  13130. INDEX                                                              244
  13131. _______________________________________________________________________
  13132.  
  13133. tar, 148                             TeX, 8
  13134. TCP/IP, 5, 14--15, 185--199          texinfo, 9
  13135.    /etc/host.conf, 193               text editor
  13136.    /etc/hosts, 192                       comparing, 123
  13137.    /etc/networks, 192                    defined, 123
  13138.    /etc/resolve.conf, 193            text editors, 7
  13139.    broadcast address, 188            text processing, 8--11
  13140.    configuration  scripts   for,     tin, 200
  13141.       189                            Torvalds, Linus, 3, 20
  13142.    configuring, 186, 187             transport
  13143.    debugging, 193                        for e-mail, 200
  13144.    displaying  routing   tables,     trouble
  13145.       194                                running into, 71--84
  13146.    gateway address, 188
  13147.    hardware  requirements   for,     UID
  13148.       186                                defined, 144
  13149.    ifconfig, 190                     umount, 158
  13150.    inetd, 191                            unmounting floppy disks with,
  13151.    IP address, 187                          152
  13152.    named, 192                        UNIX
  13153.    nameserver address, 188               basic concepts, 86--92
  13154.    NET-2 implementation of, 185          commercial, 19, 22, 25--27
  13155.    network address, 188                  directory structure, 90
  13156.    network mask, 187                     for the PC, 25--27
  13157.    over serial line, 194--199            free implementations, 26
  13158.    point-to-point    connection,         manual pages for, 97
  13159.       195                                multitasking
  13160.    PPP, 195                               defined, 86
  13161.    rc.inet, 189                          popularity, 3
  13162.    rc.inet1, 189                         wizards, 1
  13163.     sample, 190                      unmounting filesystems, 158
  13164.    rc.inet2, 189                     upgrading, 23
  13165.     sample, 191                      USENET, 200--202
  13166.    rc.net, 189                           Linux-related newsgroups, 34
  13167.    route, 190                            posting tips, 38
  13168.    routed, 191                       user account
  13169.    SLIP, 194--199                        creating, 86
  13170.     device names for, 196            user ID
  13171.     dynamic   IP  address   with         defined, 144
  13172.       dip, 196                       useradd, 146
  13173.     static IP  address with dip,     userdel, 146
  13174.       195                            username
  13175.     static   IP   address   with         defined, 144
  13176.       slattach, 196                  users
  13177.    syslogd, 191                          adding, 144
  13178.    troubleshooting, 193                   adding with adduser, 146
  13179. Tcsh, 105                                 adding with useradd, 146
  13180. tcsh, 105                                changing fullname for, 146
  13181. telecommunications, 15                   changing login shell for, 146
  13182. term, 15                                 deleting, 146
  13183. INDEX                                                              245
  13184. _______________________________________________________________________
  13185.  
  13186.    disabling, 146                        defined, 90
  13187.    full name of, 145
  13188.    group ID of, 144                  X11R6, 165
  13189.    home directory of, 145            XF86Config, 171
  13190.    in groups, 112                    XFree86, 12, 165
  13191.    list groups for, 147                  configuration file for, 171
  13192.    login shell of, 145                   configuring, 170
  13193.    password of, 145                      hardware  requirements   for,
  13194.    setting attributes for, 146              166
  13195.    setting guidelines for, 140           installing, 168
  13196.    setting password for, 146             RAM requirements for, 168
  13197.    system security and, 139              video chipsets supported  by,
  13198.    user ID of, 144                          166
  13199.    username of, 144                  xfsck, 159
  13200. UUCP, 14, 199--200                   X Window System, 12--13, 165--184
  13201.                                          defined, 165
  13202. variables                              
  13203.    environment, 133
  13204.    in shell scripts, 132
  13205.    shell, 132
  13206. vendor
  13207.    list, 211--213
  13208. vi, 7, 123--130
  13209.    changing text, 127--128
  13210.    command mode, 124
  13211.    deleting text, 126--127
  13212.    edit mode, 124
  13213.    including files, 129
  13214.    inserting text, 125--126
  13215.    last line mode, 124
  13216.    moving cursor, 128
  13217.    quitting, 128
  13218.    saving changes, 128
  13219.    shell commands from, 130
  13220.    starting, 124
  13221.    switching files, 129
  13222.    writing changes, 128
  13223. virtual consoles, 5, 102
  13224. Volkerding, Patrick, 43
  13225.  
  13226. wildcard characters
  13227.    *, 106
  13228.    ?, 107
  13229.    defined, 106
  13230.    in filnames, 106--108
  13231. wildcard expansion
  13232.    defined, 106
  13233. Windows NT, 25
  13234. WINE, 16
  13235. word processing, 10
  13236. working directory
  13237.  
  13238.  
  13239.  
  13240.  
  13241.  
  13242.  
  13243.  
  13244.  
  13245.  
  13246.