Glossary

Shell

A shell is a program that reads commands from a user (or a script), interprets them, and invokes other programs or kernel services to carry them out. It is the traditional interactive interface to Unix and remains the principal way that experienced Linux users drive their systems. The name evokes a "shell" around the kernel: the layer you actually talk to.

Shells fall into two broad families:

  • Bourne family: sh, bash, dash, ksh, ash, zsh—descendants of Stephen Bourne's 1977 shell. Their syntax is the one standardised by POSIX.
  • C family: csh, tcsh—modelled loosely on C syntax, historically common on BSD systems, now uncommon.

A shell provides command execution, variable expansion, pipelines, redirection, glob expansion, job control, history, and a scripting language. Modern interactive shells like bash, zsh, and fish add tab completion, syntax highlighting, spell correction, and plug-in systems. Most Linux distributions default to bash for login shells and dash as the faster, POSIX-only /bin/sh.

The choice of shell is largely personal for interactive use—zsh and fish have particularly passionate fans—but for scripts it is important to write to a specific interpreter and stick to its features. A #!/bin/bash script may use arrays and [[ ... ]], while a #!/bin/sh script should restrict itself to POSIX features for portability.

Related terms: bash, zsh, fish, Terminal

Discussed in:

Also defined in: Textbook of Linux