COPYRIGHTED MATERIAL PART IV Using the Shell 175
Total Page:16
File Type:pdf, Size:1020Kb
2817cfm.qxd 11/20/00 10:03 AM Page x CONTENTS AT A GLANCE Introduction xxxvii PART I Introducing Unix 1 Chapter 1 History and Background of Unix 3 Chapter 2 Which Unix? 13 Chapter 3 Some Basic Unix Concepts 29 PART II Getting Started 39 Chapter 4 Logging In and Looking Around 41 Chapter 5 Navigating the Filesystem 55 PART III Unix Desktop Environments 63 Chapter 6 The X Window System: An Overview 65 Chapter 7 Advanced X Techniques 77 Chapter 8 Window Managers 97 Chapter 9 KDE 121 Chapter 10 Gnome 149 COPYRIGHTED MATERIAL PART IV Using the Shell 175 Chapter 11 Introduction to the Bourne (Again) Shell 177 Chapter 12 Manipulating Files and Directories 189 Chapter 13 Customizing the Shell Environment 201 Chapter 14 Input and Output Redirection 215 Chapter 15 Other Shells 227 2817cfm.qxd 11/20/00 10:03 AM Page xi Contents at a Glance xi PART V Using Text Editors 241 Chapter 16 The ed Editor 243 Chapter 17 The vi Editor 255 Chapter 18 GNU Emacs 269 Chapter 19 pico, joe, and jed 285 Chapter 20 Graphical Text Editors 297 PART VI Shell Programming 311 Chapter 21 An Introduction to Shell Programming 313 Chapter 22 Variables 321 Chapter 23 Flow Control, Part I: Conditional Flow Control 333 Chapter 24 Flow Control, Part II: Iterative Flow Control 351 Chapter 25 Regular Expressions 369 Chapter 26 Signals and Status 389 PART VII Basic System Administration 407 Chapter 27 What Is System Administration? 409 Chapter 28 System Programming 417 Chapter 29 Managing Users and Groups 439 Chapter 30 Disks and Filesystem Management 457 Chapter 31 Installing and Managing Software 477 Chapter 32 Getting to Know the Kernel 501 Chapter 33 Managing Print Services 517 PART VIII Network Administration 541 Chapter 34 Introduction to Unix Networking 543 2817cfm.qxd 11/20/00 10:03 AM Page xii xii Contents at a Glance Chapter 35 Network Interfaces and Routing 563 Chapter 36 The Distributed System 591 Chapter 37 Integrating Unix with Other Platforms 605 Chapter 38 Network Security 631 PART IX Administering Services 655 Chapter 39 Selecting a Suite of Services 657 Chapter 40 Electronic Mail 667 Chapter 41 USENET News 687 Chapter 42 World Wide Web Services 707 Chapter 43 Remote Access (inet) Services 743 Appendices 767 Appendix A Common Unix Commands 767 Appendix B Documentation and Resources 799 Appendix C Other Types of Unix 821 Glossary 832 Index 853 2817cfm.qxd 11/20/00 10:03 AM Page xiii CONTENTS Introduction xxxvii PART I Introducing Unix 1 1 History and Background of Unix 3 What Is Unix? 5 All Versions of Unix Are Multiuser 6 All Versions of Unix Are Multitasking 6 All Versions of Unix Can Use the Same Commands 6 What Does This Mean to the End User? 7 Creation and History of Unix 8 The Story of C 8 The Rise of Unix Derivations 9 The Internet and Unix 9 Unix Today 10 The Unix Philosophy 11 Summary 12 2 Which Unix? 13 The Fragmentation of Unix 14 Differences between Unices 16 Unix Versions Used in This Book 17 Linux 17 FreeBSD 18 Solaris 19 We GNU, Do You? 19 Getting to Know GNU 20 The Free Software Foundation 23 If GNU’s Not Unix, What Is It? 23 The Free Software Explosion 24 The Meteoric Rise of Open Source 24 Summary 26 2817cfm.qxd 11/20/00 10:03 AM Page xiv xiv Contents 3 Some Basic Unix Concepts 29 Structure of a Unix System 30 The Kernel 30 The Shell 31 Which Shell? 32 The File System 33 Files and Directories 34 Users 34 The Superuser 35 Commands 35 Summary 37 PART II Getting Started 39 4 Logging In and Looking Around 41 Getting Access to Unix 42 Logging In for the First Time 45 Changing Your Password 49 What Are These Files? 50 Logging Out 52 Summary 53 5 Navigating the Filesystem 55 Where Are You? 56 Absolute vs. Relative Path Names 57 Moving Around 57 What’s Where? 58 /bin 59 /etc 59 /home 60 /tmp 60 /usr 60 /usr/local 60 /var 61 Summary 61 2817cfm.qxd 11/20/00 10:03 AM Page xv Contents xv PART III Unix Desktop Environments 63 6 The X Window System: An Overview 65 What Is the X Window System? 66 Desktops and Window Managers 67 Window Managers 68 Desktop Environments 69 Which to Use? 70 The Structure of X 71 How Does X Work? 72 Installing and Configuring X 73 Basic X Configuration 74 X Window System Problems 74 Summary 75 7 Advanced X Techniques 77 Using X Applications over a Network 78 The DISPLAY Variable 79 Fonts 81 Installing Fonts 81 Linux 82 FreeBSD 82 Solaris 83 X Font Servers 83 Building a Font Server 84 Using a Font Server 84 Using International Fonts 85 Colors 86 Default Colors 86 Security 90 Using ssh 91 Securing Ports 91 The /etc/X0.hosts File 92 Using the xhost Client 93 The xauth Program 93 X and Users with Disabilities 95 Summary 96 2817cfm.qxd 11/20/00 10:03 AM Page xvi xvi Contents 8 Window Managers 97 Graphic Interfaces 99 twm 100 Configuring twm 101 IceWM 103 Configuring IceWM 104 BlackBox 107 Configuring BlackBox 107 fvwm 108 Configuring fvwm 109 AfterStep 110 Configuring AfterStep 111 WindowMaker 113 Configuring WindowMaker 114 Enlightenment 116 Configuring Enlightenment 118 Installing Themes 118 Summary 120 9 KDE 121 What Is KDE? 122 Getting and Installing KDE 123 Downloading KDE 124 Base Package Downloads 124 Recommended Package Downloads 125 Unpacking the Source Code 126 Compiling and Installing the Source Code 127 Configuring X for KDE 128 The KDE Panel 129 Virtual Desktops 133 The KDE File Manager 134 The KDE Control Center 137 Desktop 138 Background 138 Borders 138 Display 139 Fonts 139 Desktop Icons 139 2817cfm.qxd 11/20/00 10:03 AM Page xvii Contents xvii Language 139 Screensaver 140 Style 140 Information 140 Input Devices 140 International Keyboard 141 Keyboard 141 Mouse 141 Keys 141 Global Keys 142 Standard Keys 142 Network 143 Sound 143 Windows 143 Advanced 143 Buttons 144 Mouse 144 Properties 144 Titlebar 144 Password 144 Date & Time 144 Printers 145 Desktop Themes 145 Summary 147 10 Gnome 149 What Is Gnome? 150 Getting and Installing Gnome 151 Downloading Gnome 152 Base Library Downloads 152 Core Application Downloads 153 Additional Source Downloads 153 Unpacking the Source Code 154 Compiling and Installing the Source Code 155 Configuring X for Gnome 157 Using Gnome 159 The Gnome Panel 159 The Main Menu 160 2817cfm.qxd 11/20/00 10:03 AM Page xviii xviii Contents Application Launchers 165 Applets 167 The File Manager 167 The Gnome Control Center 169 Themes and the Desktop 171 Summary 173 PART IV Using the Shell 175 11 Introduction to the Bourne (Again) Shell 177 Why Bourne Shell? 179 Bourne Shell vs. Bourne Again Shell 180 Some Common Shell Commands 181 ls 182 pwd 184 cd 184 mv 185 cp 185 cat 186 more and less 186 echo 187 grep 187 Summary 188 12 Manipulating Files and Directories 189 Creating and Editing Files 190 Copying Files 193 Moving Files 193 File Ownership and Permissions 195 Who Owns the File? 195 Who Can See the File? 196 Deleting Files 197 Managing Directories 198 Creating Directories 198 Directory Ownership and Permissions 199 Deleting Directories 199 Summary 200 2817cfm.qxd 11/20/00 10:03 AM Page xix Contents xix 13 Customizing the Shell Environment 201 Elements of Shell Configuration 203 Run Control Files 204 .bash_profile 205 Environment Variables 207 Common Environment Variables and What They’re For 209 $USER 209 $MAIL 210 $PS1 210 $HOSTNAME 212 $PATH 212 Summary 213 14 Input and Output Redirection 215 Standard Input and Output 216 Introducing Redirection 217 Redirection Operators 218 Output Redirection Operators 218 Input Redirection Operators 219 Combining Input and Output Redirection Operators 221 Pipes 222 Command Substitution 223 Combining Operators 225 Summary 226 15 Other Shells 227 The Bourne Shell 228 The Korn Shell 229 Korn Shell Run Control Files 230 Environment Variables 231 pdksh 233 The C Shells 233 C Shell Run Control Files 233 Environment Variables 234 What’s the Difference? 236 The Z Shell 237 Other Shells 238 scsh 238 2817cfm.qxd 11/20/00 10:03 AM Page xx xx Contents rc and es 238 The Perl Shell 238 Summary 239 PART V Using Text Editors 241 16 The ed Editor 243 What Is ed? 244 Starting ed 245 Reading a File 247 Editing a File 248 Inputting Text 248 Deleting Text 250 Moving Text 250 Joining Lines 250 Saving and Quitting 251 Editing by Content 252 Matching 252 Substitution 253 Summary 254 17 The vi Editor 255 The One True Editor 256 vi’s Modes 257 Basic Editing in Command Mode 258 Moving the Cursor 258 Deleting Text 260 Pattern Matching and Replacing 261 Using the Shell within vi 262 Abbreviations 263 Macros 264 The set Command 265 The .exrc File 266 Saving and Exiting 267 Summary 268 2817cfm.qxd 11/20/00 10:03 AM Page xxi Contents xxi 18 GNU Emacs 269 What Is GNU Emacs? 270 Running emacs 271 emacs Peculiarities 271 Data Structures 272 Key Bindings 273 Getting Started with emacs 274 Dealing with Buffers 275 Dealing with Windows 276 The GNU Emacs Window 278 The Mode Line 279 The Mini Buffer 279 Getting Help 279 Backups and Auto-Save 280 Killing and Yanking Text 281 Searching and Replacing 281 Saving and Exiting 282 Doctor 282 Summary 283 19 pico, joe, and jed 285 pico 286 Starting pico 287 Editing Text in pico 287 joe 289 jed 293 jed’s Run Control Files 293 Running jed 295 Summary 296 20 Graphical Text Editors 297 Why Graphical Editors? 298 NEdit 299 KEdit 305 The KEdit Toolbar 306 The Menu Bar 306 gEdit 307 Summary 309 2817cfm.qxd 11/20/00 10:03 AM Page xxii xxii Contents PART VI Shell Programming 311 21 An Introduction to Shell Programming 313 Why Program the Shell? 314 What Is a Script and What Is a Program? 315 Parts of a Program 316 Statements 317 Operators 317 Regular Expressions 318 Variables 318 Comments 319 Summary 320 22 Variables 321 What Is a Variable? 322 Variable Names