Shell
The interactive command interpreter, and a programming language with unusually sharp edges.
A shell is the program that interprets typed commands: it expands words, resolves programs, wires their inputs and outputs together, and reports their exit status. It is simultaneously the most-used interface in software work and a programming language with more surprising behavior per line than any other in common use.
The behaviors that produce the most wasted time are worth learning explicitly.
Expansion happens before the program runs. A variable in a command line is substituted by the shell, so a program's own configuration file cannot influence an argument the shell already expanded — which is why a command that reads a port from the environment binds the shell's port and not the one in a local configuration file.
Shells differ. Variable names reserved in one are ordinary in another; a script assigning to a name the shell owns dies on its first line with a one-word error.
Quoting is the perennial hazard, and a pattern that becomes empty after expansion may match everything rather than nothing.
A process matcher can match itself. A wait loop that polls for a pattern present in its own command line never exits — wait on an artifact instead.
Exit status is the shell's only universal signal, and it means "the program returned zero", which frequently is not the same as "the thing you wanted happened". See Vacuous Truth.
See also14
Glob
Wildcard pattern matching over filenames, similar enough to regular expressions to mislead.
Systems & Tooling12 connections
Dotfiles
A tracked repository of personal configuration, making a machine setup reproducible.
Systems & Tooling17 connections
Terminal User Interface
An interface rendered as text in a terminal, and the design conventions that make command-line tools humane.
Graphics & Rendering16 connections
Environment Variable
A named value in a process's environment, inherited by its children — the standard configuration channel.
Systems & Tooling23 connections
Process
A running program with its own memory, environment, and identity.
Systems & Tooling33 connections
Port
The numeric endpoint a network service listens on, and a scarce shared resource on a developer machine.
Systems & Tooling19 connections
Character Encoding
The mapping between characters and bytes, and the source of a specific family of invisible bugs.
Systems & Tooling31 connections
Silent Failure
A failure that produces no signal, so the absence of an error reads as success.
Method73 connections
Ground Truth
The measurement that arbitrates, as opposed to the artifact that merely reports.
Method99 connections
Terminal Multiplexer
A program that runs many terminal sessions inside one window, splits it into panes, and keeps the sessions alive on a server after the connection drops, so long jobs and remote work survive disconnection.
Systems & Tooling10 connections
Command-Line Interface
Operating a computer by typing commands and reading text replies, the interface inherited from teletypes that remains the fastest, most scriptable, and least discoverable way to control software.
Systems & Tooling14 connections
Shebang
The "#!" line at the top of a script that tells the kernel which interpreter should run it, so a text file can be executed like a compiled program, and the portability traps around it.
Systems & Tooling11 connections
Exit Status
The small number every process returns when it ends, zero for success and anything else for failure, and the conventions that let shells, CI systems, and init systems act on it.
Systems & Tooling10 connections
Pseudoterminal
The kernel device pair that lets a terminal window, SSH session, or tmux pane pretend to be a 1970s hardware terminal, and why programs behave differently when they are not attached to one.
Systems & Tooling12 connections
Linked from19
- Character EncodingSystems & Tooling
The mapping between characters and bytes, and the source of a specific family of invisible bugs.
- ClipboardSystems & Tooling
The shared buffer behind cut, copy, and paste, invented at Xerox PARC, which offers data in several formats at once and has become a channel for snooping and for commands that paste differently from how they looked.
- Command PaletteDesign & Interface
A keyboard-summoned search box that finds and runs any command by typing part of its name, giving power users speed without forcing every feature into menus.
- Command-Line InterfaceSystems & Tooling
Operating a computer by typing commands and reading text replies, the interface inherited from teletypes that remains the fastest, most scriptable, and least discoverable way to control software.
- ContainerizationSystems & Tooling
Packaging an application with its dependencies into an isolated, reproducible runtime unit.
- Direct ManipulationDesign & Interface
Ben Shneiderman's 1983 name for interfaces where people act on visible objects with immediate, reversible feedback, such as dragging a file or resizing a shape, instead of typing commands that describe the change.
- DotfilesSystems & Tooling
A tracked repository of personal configuration, making a machine setup reproducible.
- Environment VariableSystems & Tooling
A named value in a process's environment, inherited by its children — the standard configuration channel.
- Exit StatusSystems & Tooling
The small number every process returns when it ends, zero for success and anything else for failure, and the conventions that let shells, CI systems, and init systems act on it.
- Git HookVersion Control & Delivery
Scripts Git runs automatically at points such as committing or pushing, used to check formatting and messages locally, and on servers to enforce policy or trigger deploys.
- Git WorktreeVersion Control & Delivery
An additional working directory attached to one repository, each on its own branch.
- GlobSystems & Tooling
Wildcard pattern matching over filenames, similar enough to regular expressions to mislead.
- PortSystems & Tooling
The numeric endpoint a network service listens on, and a scarce shared resource on a developer machine.
- ProcessSystems & Tooling
A running program with its own memory, environment, and identity.
- ShebangSystems & Tooling
The "#!" line at the top of a script that tells the kernel which interpreter should run it, so a text file can be executed like a compiled program, and the portability traps around it.
- Symbolic LinkSystems & Tooling
A file that points at another path, resolved transparently by most operations.
- Terminal User InterfaceGraphics & Rendering
An interface rendered as text in a terminal, and the design conventions that make command-line tools humane.
- Truncation BiasMethod
Reading a truncated result as if it were the whole result, so every counterexample is invisible.
- XDG Base Directory SpecificationSystems & Tooling
A convention placing configuration, data, cache, and state in defined directories rather than the home directory.