UNIX
A HISTORY AND A MEMOIR
ALSO BY BRIAN KERNIGHAN
The Elements of Programming Style (with P. J. Plauger) Software Tools (with P. J. Plauger) Software Tools in Pascal (with P. J. Plauger) The C Programming Language (with Dennis Ritchie) The AWK Programming Language
(with Al Aho and Peter Weinberger)
The Unix Programming Environment (with Rob Pike) AMPL: A Modeling Language for Mathematical Programming (with Robert Fourer and David Gay)
The Practice of Programming (with Rob Pike) D is for Digital
Hello, World: Opinion Columns from the Daily PrincetonianThe Go Programming Language (with Alan Donovan) Understanding the Digital World
Millions, Billions, Zillions
UNIX
A Histor y and a Memoir
Brian Kernighan
Kindle Direct Publishing
Copyright 2020 by Brian W. Kernighan Published by Kindle Direct Publishing
www.kernighan.com
All Rights Reserved
ISBN 978-169597855-3
Camera-ready copy for this book was produced by the author in Times Roman and Helvetica, using groff, ghostscript, and other open source Unix tools.
Printed on acid-free paper.
Printed in the United States of America 10 9 8 7 6 5 4 3 2 1
In memoriam DMR
Contents
Preface
ix
Chapter 1:
Bell Labs
1.1 Physical sciences at Bell Labs
1.2 Communications and computer science 7
1.3 BWK at BTL
1.4 Office space
1.5 137 127 1127 11276 19
Chapter 2:
Proto-Unix (1969)
2.1 A bit of technical background
2.2 CTSS and Multics
2.3 The origin of Unix
2.4 Whats in a name? 34
2.5 Biography: Ken Thompson
Chapter 3:
First Edition (1971)
3.1 Unix for patent applications
3.2 The Unix room
3.3 The Unix Programmers Manual 49
3.4 A few words about memory
3.5 Biography: Dennis Ritchie
Chapter 4:
Sixth Edition (1975)
4.1 File system 62
4.2 System calls 63
4.3 Shell
4.4 Pipes
4.5 Grep
4.6 Regular expressions 73
4.7 The C programming language
4.8 Software Tools and Ratfor
4.9 Biography: Doug McIlroy
viii CONTENTS
Chapter 5:
Seventh Edition (1976-1979)
5.1 Bourne shell 88
5.2 Yacc, Lex, Make
5.3 Document preparation 98
5.4 Sed and Awk 113
5.5 Other languages 117
5.6 Other contributions 121
Chapter 6:
Beyond Research
6.1 Programmers Workbench 131
6.2 University licenses
6.3 User groups and Usenix
6.4 John Lions Commentary
6.5 Portability
Chapter 7:
Commercialization
7.1 Divestiture 143
7.2 USL and SVR4
7.3 UNIX
7.4 Public relations 147
Chapter 8:
Descendants
8.1 Berkeley Software Distribution 153
8.2 Unix wars 156
8.3 Minix and Linux
8.4 Plan 9
8.5 Diaspora
Chapter 9:
Legacy
9.1 Technical 166
9.2 Organization 170
9.3 Recognition
9.4 Could history repeat?
Sources
Preface
One of the comforting things about old memories is their tendency to take on a rosy glow. The memory fixes on what was good and what lasted, and on the joy of helping to create the improvements that made life better.
Dennis Ritchie, The Evolution of the Unix Time-sharing System,
October 1984
Since its creation in a Bell Labs attic in 1969, the Unix operating system has spread far beyond anything that its creators could possibly have imagined. It has led to the development of much innovative software, influenced myriad programmers, and changed the entire path of computer technology.
Unix and its derivatives arent widely known outside a particular technical community, but they are at the heart of any number of systems that are part of ev eryones world. Google, Facebook, Amazon, and plenty of other services are powered by Linux, a Unix-like operating system that Ill talk about later on. If you have a cell phone or have a Mac, it runs some version of Unix. If you have gadgets like Alexa at home or navigation software in your car, theyre powered by Unix-like systems too. If youre bombarded by advertising whenever you browse the web, Unix systems are behind it, and of course the tracking that knows what youre doing so you can be more accurately bombarded is likely to be based on Unix as well.
Unix was created more than 50 years ago by two people, along with a small group of collaborators and camp followers. Through a sequence of lucky accidents, I was present at the creation, though certainly not responsible for any of it. At most I can take credit for a modest amount of useful software and, thanks to first-rate co-authors, some books that have helped
x
PREFACE
people to learn more about Unix and its languages, tools and philosophy.
This book is part history and part memoir, a look at the origins of Unix and an attempt to explain what Unix is, how it came about, and why it matters. The book is certainly not a scholarly work, howeverthere are no footnotesand it has become less history and more memoir than I had originally planned.
The book is written for anyone with an interest in computing or the history of inventions. It includes a certain amount of technical material, but Ive tried to provide sufficient explanation that even if you dont hav e much background, you can appreciate the basic ideas and see why they might be important. You can safely skip over anything that seems too complicated, however, so theres no need to read every word. If you are a programmer, some of the explanations may seem pretty obvious and over-simplified, but with luck some of the historical insights will be useful, and the stories that go with it might be new and interesting to you.
Although I have tried to be accurate, there are sure to be places where my memory is imperfect. Furthermore, the interviews, personal reminiscences, oral histories, books and papers that Ive relied on are not always consistent with my own memories or with each other in their accounts of who did what and when.
Fortunately, many of those involved in the early days are still alive and have helped to straighten me out. They too may suffer from memory lapses and rose-colored glasses but any errors that remain are my fault, at least until I can safely blame them on someone else.
My main purpose in writing is to tell some of the wonderful stories of an especially productive and formative time in the history of computing. Its important to understand the evolution of the technology that we use and take for granted. The decisions that shaped how that technology developed and thus defined the paths that we took were made by real people, working under the pressures and constraints of the time. The more we know about the history, the more we can appreciate the inventive genius that led to Unix and perhaps better understand why modern computer systems are as they are. If nothing else, choices that might seem wrong-headed or perverse today can often be seen as natural consequences of what was understood and could be accomplished with the resources available at the time.
The story is about more than just the Unix operating system, though thats the core. It also includes the C programming language, one of the most widely used of all languages, and at the heart of the systems that run the Internet and the services that use it. Other languages began life at Bell Labs with Unix too, notably C++, which is also widely used. Microsoft Office
PREFACE
xi
tools like Word, Excel or Powerpoint are written in C++, as are most of the browsers you might be using. A dozen or two of the core tools that programmers use daily and simply take for granted were written in the early days of Unix and are still part of every programmers toolkit, often much the same as they were 40 or 50 years ago.
Next page