Brian Kernighan and the Unix Tools
Zusammenfassung
Brian Kernighan did not design C, but he wrote the book on it. He did not design Unix, but he named it and wrote the tutorials that made it comprehensible to the world. He did not design AWK, but his initial was the K in it. He spent thirty years at Bell Labs as the most effective technical communicator in the history of systems programming — writing documentation so precise and examples so carefully chosen that his books taught an entire generation to think about programming. The K&R C standard defined a language. His prose style defined how programmers described their work.
Princeton and Bell Labs
Brian Wilson Kernighan was born on January 1, 1942, in Toronto, Ontario. He studied engineering physics at the University of Toronto (BASc 1964) and completed a PhD in electrical engineering at Princeton in 1969, writing a dissertation on graph partitioning. He joined Bell Labs the same year and stayed for thirty-one years.
At Bell Labs, Kernighan worked in the Computing Science Research Center — the same department as Ken Thompson, Dennis Ritchie, and Doug McIlroy — during the period when Unix and C were being created. His role was less architectural than theirs; he built tools, wrote documentation, and communicated what the group was doing to the outside world with exceptional clarity.
Naming Unix
The name “Unix” is attributed to Kernighan, who coined it as a pun on Multics — the overengineered predecessor that Bell Labs had just abandoned. The original spelling was “Unics” (Uniplexed Information and Computing Service, as opposed to Multiplexed), which Kernighan and others used before it was respelled Unix. The name suggested something simpler, singular, and intentionally less than Multics had promised.
“Hello, World!” and K&R
In 1974, Kernighan wrote an internal Bell Labs tutorial titled “Programming in C: A Tutorial” that contained the first published “Hello, World!” example:
main( ) {
printf("hello, world\n");
}The phrase became the universal first program — the default demonstration that a development environment works, the opening example of virtually every programming language textbook since 1978. It has been translated into hundreds of programming languages. Its origin in Kernighan’s tutorial is rarely cited.
In 1978, Kernighan and Dennis Ritchie published “The C Programming Language” — universally known as K&R after its authors’ initials. At 228 pages, it was remarkable for what it did not include: no unnecessary verbiage, no extended philosophy, no padding. Every example was a complete, runnable program. Every sentence was there because it was needed.
K&R defined the C language for most practical purposes. Implementations that conformed to K&R C — rather than the later ANSI standard — were called “K&R C.” The book went through multiple editions (K&R2 for ANSI C, 1988) and remained in print and in use for decades.
Kernighan’s Writing Rule
Kernighan has described his approach to technical writing: write clearly, use real examples, verify that every example works, cut everything that doesn’t add understanding. The discipline shows. Programmers who learned C from K&R often report that the book’s clarity was more than pedagogical — it modeled how to think about programs.
AWK: Data Processing at the Command Line
In 1977, Kernighan, Alfred Aho, and Peter Weinberger developed AWK — a pattern-action language for processing structured text. AWK programs specified patterns (conditions) and actions (what to do when the pattern matched):
# print lines where the third field is greater than 100
$3 > 100 { print $1, $3 }AWK was designed for data processing at the command line: parsing log files, reformatting CSV data, summarizing structured text. It was the first practical data-manipulation language that non-programmers could use effectively. Before spreadsheets were ubiquitous, AWK was how Unix administrators processed data.
AWK influenced sed (stream editor), Perl (which Larry Wall designed as a more powerful AWK), and every subsequent scripting language oriented toward text processing. The pattern-action model — test a condition, take an action — appears in Python’s list comprehensions, JavaScript’s array methods, and modern query languages.
The Unix Programming Environment
In 1984, Kernighan and Rob Pike published “The Unix Programming Environment” — a book that documented the philosophy of Unix programming at a moment when Unix was spreading from research labs to universities to commercial use, and thousands of new programmers needed to understand not just the commands but the underlying design principles.
The book articulated the Unix philosophy more explicitly than any internal Bell Labs document had: programs should do one thing well; programs should work together; programs should deal in text streams as the universal interface. This formulation — clear, specific, practical — became the canonical statement of the philosophy that Thompson and McIlroy had built into Unix empirically.
Princeton and Later Work
Kernighan left Bell Labs in 2000 when it was reorganized as part of Lucent’s restructuring and joined Princeton University as a professor, where he taught undergraduate programming courses. His Princeton courses became famous for treating first-year students as capable of learning real programming — not simplified “educational” programming — and for emphasizing reading, writing, and thinking about code as a craft.
He continued writing. “The Practice of Programming” (with Pike, 1999) was as widely read as K&R in a later generation. “The Go Programming Language” (with Alan Donovan, 2015) brought the K&R treatment to Go. Each book had the same quality: real examples, nothing superfluous, complete programs rather than fragments.
Dead End: Documentation as Afterthought
Kernighan’s career is a partial argument against the prevailing industry norm that documentation is a secondary activity, written after the code is done and often not at all. The quality of Bell Labs’ documentation — particularly the Unix manual pages, many of which Kernighan contributed to — was a significant factor in Unix’s adoption. Programmers could understand what they were using.
The Manual Page Tradition
Unix manual pages — the man command — were written to be precise, complete, and terse. A good manual page told you what the program did, what its options were, what it assumed, and what errors it could return. The format descended directly from Bell Labs’ documentation culture, in which Kernighan was a central figure. As software development moved from research labs to commercial organizations, documentation quality declined — treated as overhead rather than engineering. The resulting proliferation of Stack Overflow questions about basic API behavior is partly a consequence of this shift.
Kernighan’s collaboration with Ritchie on K&R is covered in Dennis Ritchie and the C Language. The Unix tools and philosophy he helped articulate are explored in The Unix Story.
📚 Sources
- Kernighan, Brian W. & Ritchie, Dennis M.: The C Programming Language (1978; 2nd ed. 1988), Prentice-Hall
- Kernighan, Brian W. & Pike, Rob: The Unix Programming Environment (1984), Prentice-Hall
- Kernighan, Brian W. & Pike, Rob: The Practice of Programming (1999), Addison-Wesley
- Aho, Alfred V.; Weinberger, Peter J. & Kernighan, Brian W.: The AWK Programming Language (1988), Addison-Wesley
- Kernighan, Brian W.: UNIX: A History and a Memoir (2020), independently published via KDP https://scis.uohyd.ac.in/~apcs/itw/UNIXProgrammingEnvironment.pdf