Chapter 6. The Bash Shell

The shell is a program that acts as a buffer between you and the operating system. In its role as a command interpreter, it should (for the most part) act invisibly. There are three main uses for the shell: interactive use; customizing your Linux session by defining variables and startup files; and programming, by writing and executing shell scripts.

The original Bourne shell became the standard shell for writing shell scripts. The Bourne shell is still found in /bin/sh on Linux systems but is now usually a symbolic link to Bash. Because the Berkeley C shell (csh and later tcsh) offered better features for interactive use, such as command history and job control, for a long time the standard practice was to use the Bourne shell for programming and the C shell for daily use. David Korn at Bell Labs enhanced the Bourne shell by adding csh-like features; his shell is known as the Korn shell (ksh).

The Free Software Foundation developed a clone of the Bourne shell, written from scratch, named “Bash,” the Bourne-Again SHell. Over time, Bash has become a POSIX-compliant version of the shell, incorporating many popular features from other shells, such as csh, tcsh, and ksh. Bash is the primary shell for Linux.

Another popular shell is the Z Shell, zsh, which is similar to ksh but with many extensions. zsh differs from Bash both in being based on ksh and because it does not attempt to be POSIX-compliant the way Bash does.

This chapter covers Bash. All references are ...

Get Linux in a Nutshell, 6th Edition now with O’Reilly online learning.

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