Other meanings of Unix shell
Computing
A Unix shell is a command-line interpreter that provides a user interface for Unix and Unix-like operating systems. It executes commands read from standard input or a script file, offering a powerful environment for controlling system processes, file manipulation, and program execution. The shell also serves as a scripting language, enabling automation of complex tasks. Its name derives from its role as the outer layer of the operating system, wrapping the kernel. The concept originated in the 1970s with the Thompson shell, evolving through the Bourne shell to modern variants like Bash and Zsh, each adding features for interactive use and programming.
The Unix shell operates as a command-line interpreter that reads user input, parses it into commands, and executes them via system calls. It provides built-in commands (e.g., cd, echo, export) and external program execution, with features like piping (|), redirection (>, <), and job control (background/foreground processes).1 The shell also supports variables, wildcard expansion, command substitution, and control structures (if, for, while), making it a full scripting language. Its design emphasizes composability: small utilities can be chained to perform complex tasks, a philosophy rooted in Unix's modularity.2
The first Unix shell, the Thompson shell, was written by Ken Thompson in 1971 at Bell Labs, providing basic command execution and redirection but lacking scripting capabilities. In 1979, the Bourne shell (sh) by Stephen Bourne introduced variables, control flow, and scripting, becoming the standard for Unix V7.3 The C shell (csh) by Bill Joy added C-like syntax and interactive features like history and aliases, but its scripting was less robust. The Korn shell (ksh) by David Korn combined Bourne compatibility with csh's interactive features. Bash, created by Brian Fox in 1989 for the GNU Project, became the default on Linux and macOS, incorporating features from sh, csh, and ksh.4
Modern Unix shells include Bash, Zsh, Fish, and Dash, each with distinct strengths: Zsh offers advanced completion and theming, Fish emphasizes user-friendliness, and Dash is optimized for speed and POSIX compliance. The POSIX standard (IEEE 1003.1) defines a common shell language based on the Korn shell, ensuring portability across systems.5 Shells also differ in interactive features: command-line editing (readline), programmable completion, and prompt customization. The choice of shell affects both user experience and script portability, as scripts written for Bash may not run in POSIX-only environments like Dash.
Beyond common usage, shells have niche features: the here-document allows embedding multi-line input, and process substitution (<(command)) enables treating command output as a file. The trap command handles signals, enabling cleanup on exit. Shells also support coproc for background processes with bidirectional pipes. Historically, the rc shell (Plan 9) simplified syntax, influencing later designs. Security aspects include shellshock (2014), a vulnerability in Bash's function parsing, highlighting the shell's deep integration.6 Additionally, shells can be used as login shells, affecting environment setup, and the dot command sources scripts in the current context.
The Unix shell remains a fundamental component of Unix-like systems, balancing interactive usability with scripting power.
Help improve the encyclopedia. Reports go straight to the site manager.