The ed line editor: bravado, utility, and history

I stumbled on the book Ed Mastery by Michael W. Lucas and couldn’t tell immediately whether it was serious. In a sort of technical version of Poe’s law, Lucas lays on the technical machismo pretty thick, but not thicker than some people do unironically.

Bravado

Here’s a paragraph from early in the book.

Many younger sysadmins naively hoist their pennants to defend overblown, overwrought, overdesigned text editors like ex, vi, or even the impossibly bloated nvi. A few are so lost as to devote themselves to turgid editors meant for mere users, such as vim and Emacs. This way lies not only appalling sysadmin skills, but an absence of moral fiber. As a sysadmin, you must have enough brain power to remember what you typed, to hold your own context in your head, and to truly commune with the machine on a deep and personal level.

By the time I read the reference to moral fiber I was pretty sure the author was being facetious.

Utility

The afterword to the book begins

Okay, come on Lucas, you’re not really serious here… are you?

I am. And I’m not.

This is what I find most interesting: ed is so minimal that it seems masochistic to use it, and yet it is also practical.

I’ve used Emacs for many years, but I’ve been learning the basics of vi because it is lightweight and installed everywhere [1]. But ed is even more lightweight and also installed everywhere.

My attraction to vi was that it’s complementary to Emacs. But ed is even more complementary. ed is so small that you don’t have to prioritize what to learn: just learn every feature. That is emphatically not true of vim or Emacs. Apparently you can learn ed in a day. Peter Krumins said

From my experience, once I had completed this cheat sheet and had it in front of me, I picked ed up in 30 minutes. And then spent a few more hours experimenting and trying various constructs.

History

I also find ed linguistically interesting. A lot of ed syntax is familiar because other tools inherited part of their syntax from ed. For example, sed and grep are direct descendants of ed, and the output of diff is basically ed syntax; with the -e flag the output of diffis exactly ed code. vim is “vi improved,” and vi was a visual interface to ex, which was an extension to ed.

[1] Here “everywhere” means “every Unix-like system.” When I worked in the Windows ecosystem I found this way of speaking arrogant and absurd. The large majority of the world’s desktops run Windows, and something that isn’t installed on Windows is hardly installed “everywhere.” Now I catch myself talking that way.

6 thoughts on “The ed line editor: bravado, utility, and history

  1. FWIW, I install vim on every Windows box I have to work on, because, well, if it is not installed everywhere, it ought to be.

  2. During the first half of a university course in C programming, we used the ed editor. This was on an AT&T 3b2. It served as a useful governor on our flailing efforts.

    For the second half of the course we were allowed to use vi, but could only write functions that fit on a screen. This was also a useful limitation. I recall seeking advice from the professor on a particular problem. He walked over and began pressing the ‘d’ key repeatedly. When my program was completely deleted, he looked at me and said, “There. Much better”, turned, and walked away. Were this a koan, I should say I was immediately enlightened, but at the moment I was only angry. Only later did I realize he was helping me by forcing me to rethink my approach.

Comments are closed.