From Bash to Z Shell: Conquering the Command Line

Book description

Some areas are covered in other books, but this one goes into some little-seen side streets and alleyways to show you the shortcuts to more efficient use of the shell. ...The material here is invaluable: you're not going to get it from the manual pages! I strongly recommend it.

- Ernest J.

This is a totally neat idea for a book... the command line gets addictive quickly.

- Bill Ryan, Bill's House O Insomnia

This comprehensive, hands-on guide focuses on two of the most popular and feature-rich shells, bash and zsh. From Bash to Z Shell: Conquering the Command Line is a book for all skill levels. Novices will receive an introduction to the features of shells and power users will get to explore the benefits of zsh--one of the most powerful, versatile shells ever written. Intermediate users will uncover hints, recipes, and ideas to enhance their skill sets.

The book covers shell programming, but is unique in its thorough coverage of using shells interactively--a powerful and time-saving alternative to windows and a mouse. This strong author team has written an immediately useful book, packed with examples and suggestions that users of Unix, Linux, Mac OS X and Microsoft Windows can readily apply.

Table of contents

  1. Title Page
  2. Contents at a Glance
  3. Contents
  4. About the Authors
  5. About the Technical Reviewers
  6. Acknowledgments
  7. Preface
    1. How This Book Is Structured
    2. Who Should Read This Book
    3. Prerequisites
    4. Tips for Reading Technical Material
    5. Contacting the Authors
  8. PART 1: Introducing the Shell
    1. CHAPTER 1: Introduction to Shells
      1. What's a Shell?
      2. Getting Started
      3. Simple Commands
      4. Command Lines
      5. Shell Types and Versions
      6. The Filesystem: Directories, Pathnames
      7. Where the Commands Are Located
      8. Relative Pathnames and Your Current Directory
      9. Building Pathnames with Wildcards
      10. Expansion and Substitution
      11. Building Pathnames by Completion
      12. Command-Line Editing
      13. Command History
      14. More Unix Programs
      15. Summary
    2. CHAPTER 2: Using Shell Features Together
      1. Writing Output to Files: Redirection
      2. Using Programs Together: Pipes
      3. Joining Forces
      4. Editing Data, Continuing Command Lines
      5. Command Substitution
      6. for and foreach Loops
      7. More About for Loops
      8. Building Our Script
      9. Making a Script File
      10. Running the Script
      11. Programs and the Path
      12. Using the Results (via Aliases and Functions)
      13. Summary
    3. CHAPTER 3: More Shell Features
      1. Passing Info to Processes with Environment Variables
      2. Starting and Stopping Processes: Signals, Job Control
      3. Control Shell Interpretation with Quoting
      4. Quick Directory Changes with cdpath
      5. Summary
  9. PART 2: Using bash and zsh
    1. CHAPTER 4: Entering and Editing the Command Line
      1. Terminals and Shells
      2. The Command Line
      3. Line Editing Basics
      4. Beyond Keystrokes: Commands and Bindings
      5. Options for Editing
      6. Multiline Editing and the zsh Editor Stack
      7. Keyboard Macros
      8. Other Tips on Terminals
      9. Summary
    2. CHAPTER 5: Starting the Shell
      1. Starting Shells
      2. Startup Files, Login and Interactive Shells
      3. Shell Options
      4. Getting Started with Cygwin
      5. Summary
    3. CHAPTER 6: More About Shell History
      1. Setting Up Variables
      2. "Bang" History: The Use of Exclamation Marks
      3. More Options for Manipulating History
      4. A Few More History Tricks
      5. Summary
    4. CHAPTER 7: Prompts
      1. Basic Prompting
      2. Prompts in bash
      3. Prompts in zsh
      4. Checking for Mail and Idle Terminals
      5. Summary
    5. CHAPTER 8: Files and Directories
      1. Types of Files
      2. Finding Commands and Files
      3. Managing Directories with the Shell
      4. More Argument Handling: Braces
      5. Redirection
      6. Here-Documents and Here-Strings
      7. Summary
    6. CHAPTER 9: Pattern Matching
      1. Basic Globbing
      2. Internationalization and Locales
      3. Globbing in Bash
      4. Globbing in Zsh
      5. Glob Qualifiers in Zsh
      6. Globbing Flags in Zsh
      7. Summary
    7. CHAPTER 10: Completion
      1. Getting Started with Completion
      2. Listing and Formatting Possible Matches
      3. Types of Completion
      4. Controlling Matching
      5. Reducing the Number of Matches
      6. Automatically Added Suffixes
      7. Exact Ambiguous Matches
      8. Summary
    8. CHAPTER 11: Jobs and Processes
      1. Mastering Job Control
      2. High-Power Command Substitutions
      3. Resource Limits
      4. Lying About the Program Name
      5. Summary
  10. PART 3: Extending the Shell
    1. CHAPTER 12: Variables
      1. Arrays
      2. Variable Attributes
      3. Numeric Variables and Arithmetic
      4. Complex Variable Expansions
      5. Associative Arrays
      6. Variable Indirection
      7. Summary
    2. CHAPTER 13: Scripting and Functions
      1. Programming with the Shell
      2. Input and Output
      3. Propagating Functions
      4. Traps and Special Functions
      5. Defining New Globbing Qualifiers
      6. Debugging Scripts
      7. Summary
    3. CHAPTER 14: Writing Editor Commands
      1. Widgets and Functions
      2. Simple Recipe for a Widget
      3. Making Widgets Behave Naturally
      4. Case Study I: Multiple Tasks in Widgets
      5. Case Study 2: Overriding Widgets
      6. Case Study 3: Locating Command-Line Arguments
      7. Case Study 4: Chaining Widgets Together
      8. Approximate Matching
      9. An Example Widget: Correcting Spelling
      10. Input and Output Within Widgets
      11. Summary
    4. CHAPTER 15: Writing Completion Functions
      1. Completions
      2. Helper Functions
      3. Handling Styles
      4. Making Full Use of Tags
      5. Tags, Labels, and Descriptions
      6. Prefixes and Suffixes
      7. Stand-alone Completion Widgets
      8. Summary
      9. And Finally...
  11. APPENDIX A: Unix Programs
  12. APPENDIX B: External Resources
    1. bash
    2. zsh
    3. General
  13. APPENDIX C: Glossary
  14. Index

Product information

  • Title: From Bash to Z Shell: Conquering the Command Line
  • Author(s):
  • Release date: November 2004
  • Publisher(s): Apress
  • ISBN: 9781590593769