Shells#
The shell is where the operator lives. Keystrokes become commands, commands become processes, and processes become outcomes on target. The shell is also a small programming language and a customizable user interface, the operator’s cockpit for every other tool in the handbook.
The shell ecosystem spans more than four decades. The operator
will meet several of them on different hosts: a hardened Bourne on
a production server, zsh on a workstation, ash inside a
container, rbash on a jump host, PowerShell on a Windows
target. Knowing which shell is under the cursor matters before the
first command runs.
Shells as interactive environments. For Bash specifically, including its scripting-language chapters, see Bash.
Twenty-plus shells split into four buckets the operator should recognize on contact: the everyday defaults, modern data-first designs, specialized or security-hardened options, and legacy or academic shells. The table below sketches each one’s family, age, and where the operator is likely to meet it.
Shell |
Family |
First rel. |
Where you find it |
Best for |
|---|---|---|---|---|
Bourne |
1989 |
Almost every Linux server |
The portable everyday default |
|
Bourne |
1990 |
macOS default; many distros |
Power users; rich completion |
|
Bourne |
1977 |
|
POSIX scripting baseline |
|
Bourne |
2002 |
Debian / Ubuntu |
Fast, minimal POSIX shell |
|
.NET |
2006 |
Windows; cross-platform |
Object pipelines; Azure work |
|
Original |
2019 |
Modern installs |
Structured data on the CLI |
|
mixed |
1978-2019 |
Embedded, jump-hosts, legacy, niche |
Lesser shells, kept in reference |
Modern shells trace back to one of three ancestors. The operator inherits syntax, scripting features, and habits from whichever lineage they pick, and compatibility across hosts often matters more than features.
Bourne shell (
sh, 1977): ancestor of bash, dash, ash, ksh.C shell (
csh, 1978): ancestor of tcsh.Plan 9 (
rc, 1989): ancestor of es and a model for several modern shells.
Most everything in everyday use today descends from the Bourne family.
flowchart TD
T["Thompson sh<br/>1971"]
T --> SH["Bourne sh<br/>1977"]
T --> CSH["C shell<br/>1978"]
T --> RC["Plan 9 rc<br/>1989"]
SH --> KSH["ksh<br/>1983"]
SH --> BASH["bash<br/>1989"]
SH --> ASH["ash<br/>1989"]
SH --> YASH["yash<br/>2007"]
KSH --> MKSH["mksh<br/>2005"]
KSH --> OKSH["oksh"]
BASH --> ZSH["zsh<br/>1990"]
BASH --> RBASH["rbash"]
BASH --> OIL["oil<br/>2017"]
ASH --> DASH["dash<br/>2002"]
CSH --> TCSH["tcsh<br/>1981"]
RC --> ES["es<br/>1990"]
ES -.->|inspired| MOD["modern originals<br/>nushell, elvish, ..."]
FISH["fish<br/>2005"]
NU["nushell<br/>2019"]
ELV["elvish<br/>2017"]
XON["xonsh<br/>2015"]
PS["powershell<br/>2006"]
FISH --- NU --- ELV --- XON --- PS
classDef modern fill:#1f2933,stroke:#637381,color:#e4e7eb,stroke-dasharray:3 3
class FISH,NU,ELV,XON,PS,MOD modern
Tip
Not sure which shell you’re in? echo $0 (or ps -p $$ on
shells without $0) reports the answer.
Core Industry Standards#
The operator’s default keyboard on Linux. Default login shell on nearly every distribution.
Bourne-family shell with rich completion, globbing, and plugins. Default interactive shell on macOS.
The Bourne shell. Whichever shell /bin/sh points at
on the system in question.
Debian Almquist Shell. Minimal, fast, POSIX-compliant
/bin/sh on Debian and Ubuntu.
Microsoft’s object-oriented shell. Pipelines pass typed .NET objects. Cross-platform.
Structured CLI#
Structured-data shell. Pipelines pass tables and records, not bytes.
Lesser Shells#
The rest of the shell zoo (ash, rbash, yash, ksh,
mksh, oksh, rc, es, csh, tcsh, fish,
elvish, oil, xonsh) is kept in
References. The operator opens those pages when
they land on a host running something other than the six daily
drivers above.
Beyond the Shell#
Prompts, themes, completions, dotfiles. Make the shell yours.
Run many shells in one terminal. Split panes, named windows, sessions that survive disconnect.