CONTENTS
1 The History of the UNIX System = 1
1.1 Modst Beginnings = 1
1.2 The Seventies = 3
1.3 The Eighties = 3
1.4 Into the Nineties = 4
1.5 Versions of UNIX = 5
1.6 UNIX Innovations = 7
2 Fundamentals = 9
2.1 The Old Way - Minicomputers = 9
2.2 And the New Way - PCs and Workstations = 12
2.3 Operating Systems = 12
2.4 Multitasking = 14
2.5 Networking = 14
2.6 The Kernel = 15
2.7 Programs and Processes = 15
2.8 The Vi Text Editor = 16
2.9 The UNIX Shell = 17
3 UNIX System Basics = 19
3.1 Logging In = 19
3.1.1 Logging in Using a Terminal or PC = 20
3.1.2 Logging in Using a Workstation = 21
3.2 Some Simple Commands = 23
3.3 Files and Directories = 24
3.4 UNIX System Dialogs = 26
3.5 Logging Out = 29
3.6 The UNIX User's Reference = 30
4 tering Commands Using the Shell = 33
4.1 Unix System Shells = 34
4.2 Simple Shell Commands = 35
4.3 Command Arguments = 35
4.4 Background Processes = 37
4.5 The Standard Output and the Standard Input = 39
4.5.1 Output Redirection = 40
4.5.2 Appending Output Redirection = 41
4.5.3 Redirecting the Standard Error = 42
4.5.4 Input Redirection = 43
4.5.5 Pipes = 45
4.6 Metacharacters and File Name Generation = 49
4.7 Disabling Special Characters = 52
4.8 Conclusions = 53
5 e UNIX File System = 54
5.1 UNIX File Types = 55
5.1.1 Ordinary Files = 56
5.1.2 Directory Files = 58
5.2 The Hierarchical File System = 59
5.3 Pathnames = 61
5.4 File Access Modes = 62
5.5 Directory Access Modes = 66
6 naging Your Files = 68
6.1 Pwd and Cd - The Current Directory = 69
6.2 Ls - List Files = 70
6.3 Rm - Remove Files = 77
6.4 Managing Files with Mv, Cp, and Ln = 78
6.4.1 Mv - Move Files = 78
6.4.2 Cp - Copy Files = 79
6.4.3 Ln - Create Links = 80
6.4.4 Hard Links Versus Symbolic Links = 81
6.4.5 Creating Symbolic Links with Ln = 83
6.5 Chmod - Change File Modes = 84
6.5.1 Symbolic File Access Modes = 85
6.5.2 Octal File Access Modes = 86
6.6 Chown and Chgrp - Change File Owner and Group = 88
6.7 Mkdir and Rmdir - Create and Remove Directories = 89
6.8 Find - Search for Files = 90
6.9 Pack and Compress - Save Space = 93
6.10 Tar - Collect Files = 96
6.11 File - Deduce File Types = 99
6.12 Du - Disk Usage = 101
6.13 Od - Dump Files = 102
7 What's Going On Utilities = 105
7.1 Date - Display the Date and Time = 105
7.2 Who and Finger - List Logged-in Users = 106
7.3 Passwd - Change Login Password = 108
7.4 Ps - List Processes = 109
7.5 Kill - Abort Background Processes = 109
7.6 Nohup - Run Programs While Logged Off = 111
7.7 Nice - Run Processes at Low Priority = 112
7.8 Time - Time Processes = 113
7.9 Echo - Repeat Command-line Arguments = 114
7.10 Write and Talk - Communicating with Other Users = 116
7.11 Stty and Tty - Your Terminal Handler = 118
8 Text File Utilities = 121
8.1 Cat - Type Files = 122
8.2 Pr - Title and Paginate Files = 124
8.3 Fmt - Justify Lines = 127
8.4 Lp - Print Files = 129
8.5 Pg - Browse Through a Text File = 131
8.6 Wc - Count Lines, Words, and Characters = 131
8.7 Diff - Compare Files = 132
8.8 Sort - Order Files = 137
8.9 Grep - Search for Text Patterns in Files = 141
8.10 Cut and Paste - Rearrange Columns of Files = 143
8.11 Tr - Translate Characters = 145
8.12 Spell - Find Spelling Errors = 147
8.13 Crypt - Encode Files = 148
8.14 Tee - Duplicate Output = 149
8.15 Head and Tail - Print the Beginning and End of a File = 150
9 Basic Text Editing with Vi = 154
9.1 UNIX Text Editors = 155
9.2 Checking Your Terminal Type = 156
9.3 Setting the Terminal Type = 156
9.4 Starting Vi = 157
9.5 Moving from Here to There = 160
9.6 Adding and Inserting Text = 162
9.7 Deleting Text = 165
9.8 Managing Files = 166
9.8.1 Saving Without Exiting = 167
9.8.2 Quitting Without Saving = 168
9.8.3 Editing a Different File = 168
9.8.4 Adding One File to Another = 169
9.9 Making Sense of Vi's Command Syntax = 169
10 Advanced Text Editing with Vi = 171
10.1 Escaping to the Shell = 171
10.2 Searching for Text = 172
10.3 Fine-tuning Your Screen Display = 175
10.4 More Ways to Modify Text = 176
10.5 Selecting Your Preferences = 178
10.6 Marking Text = 179
10.7 Moving Blocks of Text Using Native Vi Commands = 181
10.8 Moving Blocks of Text Aided by a Windowing System = 183
10.9 Moving Text from One File to Another Using Native Vi Commands = 184
10.10 Recovering Accidental Deletions = 186
10.11 Filtering the Buffer = 188
10.12 Vi Macros = 190
10.12.1 Buffer Macros = 190
10.12.2 Maps = 192
10.12.3 Insert-mode Maps = 194
10.12.4 Abbreviations = 194
10.13 Line-editing Commands = 195
10.14 Open-line Editing = 195
11 Bourne Shell Programming Language = 197
11.1 Executing a Shell Program = 198
11.2 Shell Variables = 201
11.2.1 Read-only Shell Variables = 202
11.2.2 Exporting Shell Variables = 203
11.2.3 Using Shell Variables Interactively = 204
11.2.4 Automatic Shell Variables = 204
11.2.5 Standard Shell Variables = 205
11.2.6 The Search Path = 207
11.2.7 Handling Null and Unsert Variables = 209
11.3 Quating Special Characters = 210
11.4 Command Exit Status = 212
11.5 Simple Conditionals = 213
11.6 Simple Commands, Pipelines, Lists = 214
11.7 The If Conditional = 215
11.8 Shell Program Arguments = 217
11.9 The While and Until Conditional Loops = 220
11.10 Structured Commands = 222
11.11 The For Statement = 223
11.12 The Case Statement = 224
11.13 Break and Continue = 225
11.14 Command Substitution = 226
11.15 Shell Substitutions = 228
11.16 Here Documents = 228
11.17 Shell Functions = 230
11.18 Set - Display Variables and Specify Shell OPerating Modes = 232
11.19 Test - Evaluate Conditions = 237
11.20 Expr - Evaluate Expressions = 238
11.21 Ulimit - Set and Display Resource Limits = 241
11.22 Getopts - Manage Options in Scripts = 242
11.23 The Bourne Shell's Built-in Commands = 243
12 A Few Shell Programs = 246
12.1 When Do You Use the Shell Programming Language? = 246
12.2 How Many Users Are Logged In? = 247
12.3 Listing Subdirectories = 249
12.4 Listing Files in the Current Subtree = 252
12.5 Using Eval to Reevaluate Command Lines = 255
13 The AWK Programming Language = 258
13.1 Simple Scripts = 259
13.2 Flow of Control Statements = 265
13.2.1 The If Statement = 265
13.2.2 The While and Do Statements = 267
13.2.3 The For Satement = 269
13.3 AWK Patterns and Expressions = 270
13.4 Arrays = 271
13.5 Built-in Variables = 274
13.6 Built-in Functions = 276
13.7 Print and Printf = 278
13.8 Perl : Successor to A자 = 282
14 The Sed Text Editor = 283
14.1 Text Modification = 285
14.2 Control Flow = 287
14.3 Input and Output = 289
14.4 The Sed Hold Space = 290
15 UNIX Platforms = 292
15.1 System Evaluation Criteria = 293
15.1.1 The Herd Mentality = 293
15.1.2 Communicating with Your Peers = 293
15.1.3 Application Software = 294
15.1.4 Service, Support, and All That = 294
15.1.5 Graphics = 295
15.2 Performance = 297
15.2.1 Integer Performance = 298
15.2.2 Floating Point Performance = 299
15.2.3 Graphics Performance = 299
15.3 Common UNIX Platforms = 300
15.3.1 Minicomputers = 300
15.3.2 The Macintosh = 300
15.3.3 PCs = 301
15.3.4 Workstations = 302
16 Window Systems = 305
16.1 What Is Window System? = 306
16.2 Window Interfaces : Some Basic Concepts = 306
16.3 Window Operations = 308
16.4 Architecture of the X Window System = 310
16.4.1 X Fits Well with "Open Systems" Idea = 314
16.4.2 A Distributed Window System = 315
16.4.3 The X Server and Display Connections = 316
16.4.4 Applications, or X Clients = 316
16.4.5 Window Managers = 317
16.4.6 Compatibility : The ICCCM = 317
16.5 Starting X = 318
16.5.1 If the X Server Is Started for You = 319
16.6 Customizing X = 320
16.6.1 X Resources = 321
16.6.2 Tools to Examine Resources = 323
16.7 The X Display = 324
16.7.1 Display Permissions = 326
16.8 Window Manager Configuration Files = 328
16.8.1 Motif = 328
16.8.2 OPEN LOOK = 331
16.8.3 Twm Specifics = 332
16.9 Other Window Systems = 334
16.10 Limitations of X = 337
17 Networking = 338
17.1 Uucp and IP Networking : Overview = 338
17.2 Terminology = 340
17.3 The UUCP Family = 342
17.4 Sending Mail Through UUCP = 343
17.5 UUCP Administration = 344
17.6 Cu and Tip = 345
17.7 IP Networking = 345
17.8 The Ethernet = 347
17.9 How Ethernet Works = 348
17.10 Other Hardware Technologies = 349
17.11 Software Networking Protocols = 349
17.12 Network Addressing = 350
17.13 The Network Information Center = 351
17.14 User-level Berkeley Networking Commands = 354
17.15 Administration of Berkeley Networking = 354
17.16 Network File Systems = 356
17.17 NFS Administration = 356
17.18 NFS and Automounting = 359
17.19 Network Information Service = 359
17.20 Networking the World : LANS, WANS, and Routers = 361
17.21 Packets = 362
17.22 Network Daemons = 363
17.23 Booting over the Network = 364
17.24 Networking UNIX with Other Kinds of Machines = 365
18 LAN Networking Utilities = 368
18.1 User-level Networking Commands = 368
18.2 Connecting to Other Systems = 369
18.2.1 Rlogin = 370
18.2.2 Telnet = 371
18.3 Executing Commands on Remote Systems - Rsh/Remsh = 374
18.4 File Transfer Between Hosts = 376
18.4.1 Remote Copy, Rcp = 376
18.4.2 Ftp and Anonymous Ftp = 377
18.5 What's Going on on the Network? = 383
18.5.1 Rwho = 383
18.5.2 Ruptime = 384
18.5.3 Rup = 384
18.5.4 Ping = 385
19 UUCP Networking Utilities = 386
19.1 UUCP User-level Commands = 386
19.2 Connecting to Other Systems = 387
19.2.1 Cu, Call UNIX = 387
19.2.2 Tip = 391
19.3 File Transfer Between Hosts = 393
19.3.1 UUCP = 395
19.3.2 Uuto and Uupick = 397
19.4 Executing Commands on Remote Systems - Unix = 398
19.5 UUCP Status Commands = 400
19.5.1 Uustat = 400
19.5.2 Uulog = 400
19.5.3 Uuname = 401
20 System Management = 402
20.1 The Superuser = 403
20.2 System Configuration = 404
20.2.1 Adding Device Drivers = 405
20.2.2 Special Device Files = 406
20.3 User Account Administration = 406
20.3.1 the Passwd and Group Files = 407
20.3.2 Login Name = 408
20.3.3 User ID = 408
20.3.4 Group ID = 408
20.3.5 Initial Password = 409
20.3.6 Home Directory = 409
20.3.7 Login Shells and /etc/shells = 409
20.3.8 Deleting a User Account = 410
20.4 File Systems = 411
20.4.1 Disk Partitions (Pre-SVR4) = 412
20.4.2 Disk Slices (SVR4) = 412
20.4.3 Building a File System = 413
20.4.4 Mounting a File System = 414
20.4.5 Unmounting a File System = 416
20.4.6 Checking File System Consistency = 417
20.4.7 The Root File System = 418
20.4.8 Network File Systems = 418
20.4.9 File System Tables = 419
20.4.10 File System Types = 419
20.5 Booting = 420
20.5.1 Traditional Boot Process = 420
20.5.2 SVR4 Booting and Init States = 421
20.5.3 Shutting Down the System = 421
20.6 Backups = 422
20.6.1 Backup and Restore Basics = 422
20.6.2 Backup Levels = 422
20.6.3 Backup Schedule = 423
20.6.4 Backup Media = 424
20.6.5 Rotation of Media = 425
20.7 Swapping and Sticky Mode = 425
20.8 Setuid and Setgid Modes = 426
20.9 Fifo Files = 427
20.10 Links and Symbolic Links = 428
20.11 Device Names = 429
21 System Management Utilities = 431
21.1 Su - Become Superuser = 431
21.2 Mount and Unmount File Systems = 432
21.2.1 Mount = 432
21.2.2 Mountall = 434
21.2.3 Umount, Umountall = 434
21.3 Shutting Down the System = 435
21.3.1 Sync - Synchronize Disk Information = 435
21.3.2 Init = 436
21.3.3 Shutdown = 436
21.3.4 Halt = 437
21.4 Mknod - Create Special Files = 437
21.5 Backups = 438
21.5.1 Ufsdump = 438
21.5.2 Ufsrestore = 438
21.5.3 Volcopy and Labelit = 440
21.6 Newfs - Create a File System = 441
21.7 Fsck - Check and Repair File Systems = 442
21.8 Dd - Convert Files = 443
21.9 Df - Disk Free Space = 444
21.10 Cron, Crontab - Run Programs at Specified Times = 444
22 Security = 446
22.1 Data Protection = 447
22.1.1 Irrecoverable Data Loss = 447
22.1.2 Backup Security = 448
22.2 Protection Against Intruders = 448
22.2.1 Physical Security = 449
22.2.2 Terminal Line Security = 450
22.2.3 Telephone Access = 450
22.3 Security Procedures and Education = 451
22.3.1 Know Your System = 451
22.3.2 The Human Dimension = 452
22.3.3 The (Friendly) Cracker = 452
22.4 Passwords and Accounts = 453
22.4.1 Who Gets an Account = 453
22.4.2 Basic Rules and Initial Password = 454
22.4.3 How Passwords Work = 454
22.4.4 How They Are Cracked = 455
22.4.5 Password Filtering = 455
22.4.6 Password Aging = 456
22.4.7 Shadow Passwords = 456
22.4.8 The Root Password = 456
22.5 Superuser Precautions = 457
22.6 Unix File Permissions and Security = 458
22.6.1 Protection of System Directories = 458
22.6.2 Setuid and Setgid Programs = 459
22.7 Security of Installed Software = 460
22.7.1 Outside Software = 461
22.7.2 Viruses and Worms = 462
22.7.3 Trojan Horse Programs = 462
22.7.4 User-provided Security Holes = 463
22.8 Security for the Individual User = 463
22.8.1 E-mail = 463
22.8.2 Protection of Files = 464
22.8.3 Encryption = 464
22.9 Network Security Considerations = 465
22.10 Security Discussions = 466
22.11 CERT - Computer Emergency Response Team = 467
23 UNIX System Kernel = 468
23.1 Overview = 469
23.2 Processes = 470
23.2.1 The Process Table and the User Table = 471
23.2.2 Sharing Program Text and Software Libraries = 473
23.2.3 System Calls = 473
23.2.4 User Mode and Kernel Mode = 474
23.2.5 The Fork, Exec, and Wait System Calls = 475
23.2.6 Handling Signals = 478
23.2.7 Scheduling Processes = 479
23.2.8 Swapping and Paging = 480
23.2.9 Zombie Processes = 482
23.3 Networking = 482
23.4 Booting = 484
23.4.1 The First Processes = 485
23.4.2 The Init Process = 486
23.5 The File System = 487
23.5.1 Directories = 490
23.5.2 I-nodes = 492
23.5.3 The File Table = 494
23.5.4 Pipes = 495
23.5.5 Network File Systems = 495
23.6 Device Drivers = 496
23.6.1 Special Device Files and the Cdevsw and Bdevsw Tables = 497
23.6.2 Interrupts = 500
23.6.3 Traditional Character Handling = 500
23.6.4 Process Groups = 502
23.7 Communication Extensions = 502
23.7.1 Sockets = 502
23.7.2 Streams = 503
24 Visual Command Reference = 505
24.1 Command-line Options = 505
24.2 Overview = 506
24.3 Numeric Prefixes = 507
24.4 Operators = 508
24.5 Returning to Visual Command Mode = 508
24.6 Environment Tables = 509
24.7 Visual Commands = 509
24.8 Visual Commands Index = 516
Ⅱ Vi Options Reference = 517
Ⅲ Ex Command Reference = 522
Overview = 522
Line Specifiers = 523
Command Syntax Summary = 525
Ed Compatibility = 526
Commands = 526
Text Display Commands = 527
Text Entry Commands = 528
Cut and Paste Commands = 529
Modifying Lines = 531
Global Commands = 532
Macros and Abbreviations = 532
Operation Commands = 533
File Commands = 535
Regular Expressions = 536
Replacement Text = 538
Index = 541