Brian Kernighan
termKept in this browser · My desk
The Bell Labs researcher who wrote The C Programming Language with Dennis Ritchie in 1978, co-wrote The AWK Programming Language, and has spent five decades explaining Unix and computing in clear prose.
Kernighan's gift is the explanation. Ritchie recorded that in their 1978 book Kernighan wrote almost all the expository material and Ritchie the reference manual, and that the book served as the language's reference until a formal standard came more than ten years later. His 1981 paper Why Pascal Is Not My Favorite Programming Language, written after rewriting a book's worth of tools in Pascal, concluded that standard Pascal was not fit for serious programming, adding his experience to a spate of papers comparing C and Pascal. The line known as Kernighan's law turns the same habit on the programmer.
Who he is. Brian W. Kernighan is the Bell Labs researcher and Princeton professor whose writing taught generations how to program in C, Awk and Go and how Unix works, and whose name is attached to an early graph-partitioning algorithm and to the name Unix itself.
Career. Kernighan took a doctorate in electrical engineering at Princeton in 1969 and spent the next 30 years at the Computing Science Research Center of Bell Laboratories, heading its Computing Structures Research Department from 1981 to 2000; he then returned to Princeton as a professor, where he holds the William O. Baker chair.
Algorithms first. His research began with combinatorial problems. In the Bell System Technical Journal of February 1970 (volume 49, number 2) he and Shen Lin published An Efficient Heuristic Procedure for Partitioning Graphs, the method now known as Kernighan-Lin. The problem, in their words, is to partition the nodes of a graph with costs on its edges into subsets of given sizes so as to minimize the total cost of the edges cut; their examples are placing the components of an electronic circuit on printed circuit cards with as few connections between cards as possible, and grouping a program's parts to improve paging. The heuristic starts from any partition and improves it by interchanging nodes between the subsets, keeping the exchanges that lower the cost.
The name Unix. In his history of the system, Dennis Ritchie records that the PDP-7 system he and Ken Thompson built in 1969 had no name until well into 1970, when Brian Kernighan suggested Unix, in Ritchie's words a somewhat treacherous pun on Multics, the large time-sharing project Bell Labs had left.
Hello, world. His Tutorial Introduction to the Language B, written at Murray Hill for B on the Honeywell H6070 time-sharing system, shows what programming meant then. B was typeless: a character constant held one to four American Standard Code for Information Interchange (ASCII) characters packed into a single machine word, right-justified and zero-filled, so the tutorial's example prints a greeting by declaring three external variables, a holding 'hell', b holding 'o, w' and c holding 'orld', and calling putchar on each, followed by an exclamation mark and the newline escape *n.
The C book. Dennis Ritchie's history of C names the book that made the language portable in people's heads: in 1978 Kernighan and Ritchie published The C Programming Language, often called the white book or K&R. Ritchie is precise about the division of labour: although they worked closely together, Kernighan wrote almost all the expository material, while Ritchie was responsible for the appendix containing the reference manual and the chapter on interfacing with Unix. The book, he adds, served as the language reference until a formal standard was adopted more than ten years later.
Pascal. His critique of Pascal, dated 2 April 1981 at AT&T Bell Laboratories, starts from experience: a personal attempt to rewrite the programs of the book Software Tools, first written in Ratfor, a structured dialect of Fortran, in Pascal, which turned out harder than he had expected. Pascal, he wrote, had become the dominant language of instruction and was increasingly recommended for systems work, but in its standard form it was just plain not suitable for serious programming; among other things its case statement had no default clause, so in over 6,000 lines of Software Tools in Pascal he had used it only four times.
Books that stay in print. The first edition of The AWK Programming Language was written by Al Aho, Kernighan and Peter Weinberger in 1988; the second, on the book's own site, reflects that Awk now has several implementations and that computing has changed enormously, and its errata page is still updated in 2026. With Alan Donovan of Google's Go team he wrote The Go Programming Language (Addison-Wesley, published 26 October 2015, 380 pages). His home page lists Understanding the Digital World, a book for non-specialists on how hardware, software and networks work and the policy choices they raise, in a second edition of March 2021; and Unix: A History and a Memoir, self-published in October 2019, which tells the system's story from its creation in a Bell Labs attic in 1969.
What gets misread. Kernighan did not design C; Ritchie did, and Kernighan is precise about it in the book they shared. The Awk language is named after its three authors' initials in common telling; the record read here gives only their co-authorship. And Kernighan's law, the remark that debugging is harder than writing code, is his, but this entry has not traced its first printing.
Neighbours. C, Unix, Dennis Ritchie, Ken Thompson, Kernighan's law, Pascal and Niklaus Wirth, regular expressions and the shell.
Also known as: kernighan, bwk, brian w. kernighan
Sources
- Princeton University, Department of Computer Science, Brian Kernighan profile (read 2026-11-23): PhD in electrical engineering from Princeton in 1969; 30 years at the Computing Science Research Center of Bell Laboratories; head of the Computing Structures Research Department from 1981 to 2000; joined Princeton in 2000
- Brian Kernighan, home page, Princeton University (read 2026-11-23): The AWK Programming Language, second edition, with Al Aho and Peter Weinberger; Understanding the Digital World, second edition, March 2021; Unix: A History and a Memoir, October 2019
- Dennis M. Ritchie, The Development of the C Language, Bell Labs, 1993 (read 2026-11-23): in 1978 Kernighan and Ritchie published The C Programming Language; Kernighan wrote almost all the expository material, Ritchie the reference manual; it served as the reference until a standard more than ten years later
- Brian W. Kernighan, Why Pascal Is Not My Favorite Programming Language, AT&T Bell Laboratories, 2 April 1981, copy at the University of Virginia (read 2026-11-23): Pascal 'just plain not suitable for serious programming'; the case statement without a default, used four times in over 6,000 lines of Software Tools in Pascal
- Dennis M. Ritchie, The Evolution of the Unix Time-sharing System, Bell Labs (Nokia Bell Labs copy): the PDP-7 file system, processes and utilities; 'it was not until well into 1970 that Brian Kernighan suggested the name Unix, in a somewhat treacherous pun on Multics' (read 2026-11-23)
- B. W. Kernighan, A Tutorial Introduction to the Language B, Bell Laboratories, Murray Hill (Nokia Bell Labs copy): B on the H6070 TSS system; character constants of one to four ASCII characters in one word; the external variables a 'hell', b 'o, w', c 'orld' printed with putchar; the *n newline escape (read 2026-11-23)
- B. W. Kernighan and S. Lin, An Efficient Heuristic Procedure for Partitioning Graphs, Bell System Technical Journal 49(2), February 1970, Internet Archive record (read 2026-11-23)
- B. W. Kernighan and S. Lin, An Efficient Heuristic Procedure for Partitioning Graphs, BSTJ 49(2), pp. 291 ff., February 1970, Internet Archive full text: partition the nodes of a graph with edge costs into subsets of given sizes, minimizing the cost of the edges cut; circuit components on printed circuit cards; program paging; improvement by interchanging nodes between subsets (read 2026-11-23)
- The AWK Programming Language, Second Edition, awk.dev, updated 19 January 2026: first edition by Al Aho, Brian Kernighan and Peter Weinberger in 1988; several implementations today; errata (read 2026-11-23)
- Alan A. A. Donovan and Brian W. Kernighan, The Go Programming Language, gopl.io: published 26 October 2015 in paperback, Addison-Wesley, 380 pages, ISBN 978-0134190440; Kernighan at Bell Labs until 2000, now professor at Princeton (read 2026-11-23)