Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

The UNIX Programming Environment

📅 2022-Jun-09 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ book, unix ⬩ 📚 Archive

After reading Brian Kernighan’s excellent UNIX memoir recently, I wanted to read more about the birth and evolution of UNIX OS design, shell, tools and user interface. I decided to read the very first book from the UNIX gang at Bell Labs: The UNIX Programming Environment written by Brian Kernighan and Rob Pike.

Kernighan is undoubtedly a great technical (and humorous) writer and this book, while introducing the student to UNIX, provides context for how all the UNIX concepts came to be. The authors cover a lot of ground in the book: the file system, shell (interaction and scripts), filters (grep/sed/awk), C programming, UNIX system calls and document preparing (troff). The only piece missing is the UNIX kernel itself. Even after so many years of using Linux as my programming environment, I found good value from this book. Especially the answers to many of the idiosyncracies and constraints of UNIX that come from the PDP-11 and VAX-11 computers, the MULTICS and OS/360 OSes and the various programming languages of that era. After these 2 UNIX books, I think I have a good mental model of how and why everything is the way it is in UNIX (or classic Linux).

This book was published in 1984, for context that is 10 years after the world first saw an early version of UNIX and after UNIX had diverged into variants like 7th Edition and SVR4. That tension of the variants is clearly visible in this book whenever the authors are forced to describe how tools behave differently on those OSes. But despite that, it is overarchingly clear that by 1984 the UNIX gang is confident that they created an OS, tools and programming environment that has its own unique style and philosophy, that is highly efficient for technically proficient users.

The final sentences from this book:

That popularity [of UNIX] can be traced to the clear thinking of a few people in 1969, who sketched on the blackboard a design for a programming environment they would find comfortable. Although they didn’t expect their system to spread to tens of thousands of computers, a generation of programmers is glad that it did.

And this taste for good style is what I believe is the best takeaway from this book.

Rating: 4/4