ed: the editor that still ships with every Unix
The error message is a single character. Not “File not found,” not “Invalid command,” not even “Error.” Just: ?. This is not a bug. This is deliberate economy, made in August 1969 by Ken Thompson at Bell Labs in Murray Hill, New Jersey, on a terminal connected to a Teletype Model 33 ASR that printed text at roughly ten characters per second.
Thompson was in the middle of building Unix. He had already written an assembler and was finishing a shell. A programmer without a text editor is, professionally, just a person watching a blinking cursor — so he wrote one of those too. The model he had in mind was QED, the quick editor developed at UC Berkeley in 1965 and later ported to Multics, the mainframe project Bell Labs had recently abandoned. QED was elegant and powerful. It also expected more machine than the PDP-7 Thompson was working on, which had 4,096 eighteen-bit words of memory. QED got a haircut.
The result, ed, was a line editor in the strictest sense: it worked on one line at a time, visible only when asked. You told it to print a line (p), append text after the current line (a), delete a range (d), substitute one pattern for another (s/old/new/). It answered requests with silence. Errors got ?. Every unnecessary byte was a character the teletype didn’t have to print, a fraction of a second the operator didn’t have to wait. The terseness was not rudeness — it was arithmetic.
ed shipped as the standard text editor on every Unix from the first release, but its deeper legacy arrived through a side door. Bell Labs programmers found themselves constantly reaching for a particular ed invocation: g/re/p — global, regular expression, print every matching line. The pattern was so common that Thompson eventually extracted it into a standalone program. He named it after the command. That program is grep, and it arrived carrying ed’s regular expression engine with it — the same formalism Thompson had sharpened from QED, translating the notation Stephen Kleene had developed in the 1950s into something a programmer under deadline could actually use.
Via ed, regular expressions became standard Unix vocabulary: absorbed by sed, by awk, by perl, and eventually by the regex engine in virtually every programming language that followed. The direct editor lineage is equally clean. ed begat ex, a somewhat less hostile variant. ex begat vi, which Bill Joy wrote at Berkeley in 1976 by adding a full-screen visual mode on top of ex. The : prompt you see in vi and vim today — the signal that you have dropped into line-editing mode — is ed’s grandchild. Vim, Neovim, and every vi-compatible editor are running a distant echo of what Thompson assembled in a month on a machine with less memory than a modern JPEG (ACM Turing Award — Ken Thompson).
POSIX still mandates ed on every conforming Unix. macOS ships it. Every Linux distribution ships it. The PDP-7 it first ran on is a museum exhibit. The editor is not.
Sources
- ed (text editor) — Wikipedia — command syntax, QED lineage, grep etymology, vi lineage, and POSIX requirement.
- Kenneth Lane Thompson — ACM A.M. Turing Award — Thompson’s contributions at Bell Labs: Unix, the shell, the assembler, and the editor.