Shell

A shell is a program that reads commands typed by a user, or stored in a file, and asks the operating system to carry them out. It is the outermost layer wrapped around the kernel, which is where the name comes from, and it turns lines of text such as "list these files" or "start this program" into the system calls that actually do the work. A shell may be interactive, waiting at a prompt for one line at a time, or non-interactive, executing a script from top to bottom, and in both modes it is simultaneously a user interface and a small programming language.

The shell is an interpreter, not the operating system and not the terminal, and keeping those three apart removes most beginner confusion. The terminal (or terminal emulator) is only the window that displays text and forwards keystrokes; the kernel is the privileged core that manages memory, files and processes; the shell sits between them, parsing each line, expanding wildcards and variables, locating the requested program, and starting it as a new process. The term "shell" was popularized by Louis Pouzin, who described the idea around 1964 for Multics, and the first Unix shell was Ken Thompson's simple 1971 program. Because the shell is an ordinary user-level program, it can be replaced, which is why many shells coexist on the same machine.

Each family of shells reflects a different design decision made at a specific moment. Stephen Bourne's sh, shipped with Version 7 Unix in 1979, defined the scripting syntax (variables, loops, conditionals, functions) that nearly all later Unix shells descend from, and its core was later standardized in POSIX. Bill Joy's C shell added command history and job control in the late 1970s, while Brian Fox wrote bash (the Bourne-Again Shell) for the GNU project beginning in 1989, making it the default on most Linux systems for decades. Paul Falstad created zsh in 1990, and Apple made it the default macOS login shell with Catalina in 2019. Microsoft's PowerShell, introduced in 2006 under Jeffrey Snover's design, broke with the tradition by passing structured .NET objects between commands instead of plain text.

The pipe is the shell's signature idea: connecting the output of one small program directly to the input of the next so that simple tools compose into complex ones. Doug McIlroy proposed the concept at Bell Labs and Ken Thompson implemented it in 1973, giving the vertical-bar notation that turned the Unix philosophy of "do one thing well" into a practical workflow. A line that lists files, filters them for a pattern, sorts them and counts the result involves four independent programs running concurrently, with the shell wiring their standard input and output together and also offering redirection to and from files. The individual programs are covered under the separate entry on commands; the shell's contribution is the glue between them.

User types a line
grep error app.log | sort | uniq -c > summary.txt
Shell processing
Parse
split into words, pipes and redirections
Expand
wildcards, variables, quoting
Locate
search each directory in PATH
Kernel starts three processes
grep
writes matching lines into a pipe
sort
reads the pipe, writes sorted lines
uniq -c
counts duplicates, output goes to summary.txt
Shell collects exit statuses and shows the prompt again
the last status is available for the next conditional

Scripting is what turns a shell from a convenience into infrastructure. Saving commands in a file, adding conditionals, loops and functions, and marking it executable produces a script that can be scheduled, run on a server, or invoked in a build pipeline. Continuous integration jobs, container build files, package installers and data-wrangling steps for machine learning are overwhelmingly shell scripts or thin wrappers around them. Environment variables, the shell's mechanism for passing configuration to child processes, are why API keys, library paths and the PATH list are typically set there. Shells also differ in features such as tab completion, history search and globbing rules, so a script written for bash may fail under a stricter POSIX sh.

A common misconception is that the shell, the command line and the terminal are the same thing, and a related pitfall is that shell scripts are fragile in ways ordinary programs are not. Unquoted variables containing spaces split into several words, a failed command in the middle of a script is ignored unless the script explicitly checks for it, and pasted text from the internet runs with the user's full privileges, so a stray character in a deletion command can be destructive and cannot be undone. Graphical file managers and applications still rely on the same underlying system calls; the shell is simply the most direct and scriptable route to them, which is why it remains the standard tool of developers, system administrators and data scientists.

Read a shell as the translator and conductor between human intent and the kernel: it interprets each line, expands and wires the pieces together through pipes and redirections, launches the programs that do the real work, and lets the same lines be saved as scripts so that a one-off action becomes a repeatable procedure.

Take shell further

Ask the copilot about this term, or have our engineers assess it against your process.