The Bash Shell

This pocket reference covers Bash, particularly version 4.4, the primary shell for GNU/Linux and Mac OS X. Bash is available for Solaris and the various BSD systems, and can be easily compiled for just about any other Unix system. It can even be compiled for OpenVMS! The following topics are covered:

  • History

  • Overview of features

  • Invoking the shell

  • Command exit status

  • Syntax

  • Functions

  • Variables

  • Arithmetic expressions

  • Command history

  • Programmable completion

  • Job control

  • Shell options

  • Command execution

  • Coprocesses

  • Restricted shells

  • Built-in commands

  • Resources


Filenames, command names, options, and inline examples are shown in constant width. Input that a user should type in exactly as-is is shown in constant width userinput. Text that should be replaced with real data in examples and syntax descriptions is shown in constant width replaceable. New terms and emphasized words and phrases are shown in italics. Finally, references of the form name(N) refer to the manual page for name in section N of the online manual (accessed via the man command). Shell variable values (including environment variables) are indicated as $VAR.


The original Bourne shell distributed with V7 Unix in 1979 became the standard shell for writing shell scripts. The Bourne shell is still found in /bin/sh on many commercial Unix systems. It has not changed that much since its initial release, although it has seen modest enhancements over the years. The most notable new features added were the CDPATH ...

Get Bash Pocket Reference, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.