IN A NUTSHELL

Fourth Edition

Arnold Robbins

O'REILLY® Beijing • Cambridge- Farnham • Köln • Paris • Sebastopol • Talpel -Tokyo Table of Contents

Preface xiii

Part I. Commands and Shells

1. Introduction 3 Unix in the 21st Century 3 Obtaining Compilers 5 Building Software 6 What's in the Quick Reference 7 Beginner's Guide 8 Solaris: Standard Compliant Programs 11

2. Unix Commands 13 Introduction 13 Alphabetical Summary of Common Commands 15 Alphabetical Summary of Solaris Commands 241 Alphabetical Summary of GNU/Linux Commands 260 Alphabetical Summary of Mac OS X Commands 304 Alphabetical Summary of Java Commands 321

3. The : An Overview 341 Introduction to the Shell 341 Purpose of the Shell 342 Shell Flavors 343

vii

Shell Source Code URLs 344

Common Features 344

Differing Features 345

4. The and Korn Shells 347 348 Overview of Features Invoking the Shell 349

Syntax 350

Functions 357

Variables 358

Arithmetic Expressions 366

368 372

Command Execution 372

373 Restricted Shells Built-in Commands (Bash and Korn Shells) 374

5. tcsh: An Extended 417 Overview of Features 417 Invoking the Shell 418 Syntax 419 Variables 423 Expressions 435 Command History 438 Command-Line Manipulation 442 Job Control 445 Built-in Commands 446

6. Package Management 467 Linux Package Management 467 The Red Hat Package Manager 470 Yum: Yellowdog Updater Modified 484 up2date: Red Hat Update Agent 489 The Debian Package Manager 492 Mac OS X Package Management 520 Solaris Package Management 521 Part II. Text Editing and Processing

7. Pattern Matching 535 Filenames Versus Patterns 535 Metacharacters 536 Metacharacters, Listed by Unix Program 538 Examples of Searching 539

8. The Emacs Editor 543 Conceptual Overview 543 Command-Line Syntax 545 Summary of Commands by Group 546 Summary of Commands by Key 552 Summary of Commands by Name 555

9. The , , and vim Editors 561 Conceptual Overview 561 Command-Line Syntax 562 Review of vi Operation 565 vi Commands 567 vi Configuration 574 ex Basics 579 Alphabetical Summary of ex Commands 580

10. The Editor 595 Conceptual Overview 595 Command-Line Syntax 596 Syntax of sed Commands 598 Group Summary of sed Commands 600 Alphabetical Summary of sed Commands 601

11. The Programming Language 611 Conceptual Overview 611 Command-Line Syntax 613 Patterns and Procedures 614 Built-in Variables 616 Operators 617 Variable and Array Assignment 618 User-Defined Functions 619 Gawk-Specific Features 620 622 Implementation Limits Group Listing of awk Functions and Commands 623

Alphabetical Summary of awk Functions and Commands 623

Output Redirections 632

Source Code 634

Part HI. Software Development

12. Source Code Management: An Overview 637 Introduction and Terminology 637 Usage Models 639 Unix Source Code Management Systems 640 Other Source Code Management Systems 641

13. The Revision Control System 643 Overview of Commands 643 Basic Operation 644 General RCS Specifications 645 Alphabetical Summary of Commands 649

14. The Concurrent Versions System 659 Conceptual Overview 659 Command-Line Syntax and Options 661 Files 664 Environment Variables 665 Keywords and Keyword Modes 667 Dates 669 CVSROOT Variables 672 Alphabetical Summary of Commands 674

15. The Subversion Version Control System 697 Conceptual Overview 697 Ob taining Subversion 702 Using Subversion: A Quick Tour 704 The Subversion Command Line Client: svn 706 Repository Administration: svnadmin 733 Examining the Repository: svnlook 737 Providing Remote Access: svnserve 742 Other Subversion Components 743 16. The GNU Utility 745 Conceptual Overview 745 Command-Line Syntax 746 Makefile Lines 749 Macros 754 Special Target Names 761 Writing Command Lines 762

17. The GDB Debugger 765 Conceptual Overview 765 Command-Line Syntax 768 Initialization Files 770 GDB Expressions 771 The GDB Text User Interface 773 Group Listing of GDB Commands 773 Summary of set and show Commands 777 Summary of the Command 788 Alphabetical Summary of GDB Commands 790

18. Writing Manual Pages 813 Introduction 813 Overview of nroff/troff 814 Alphabetical Summary of man Macros 819 Predefined 823 Internal Names 823 Sample Document 823

Part IV. References

ISO 8859-1 (Latin-1) Character Set 829 Bibliography 837 Index 849