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.
BravadoHere'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.
UtilityThe 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
HistoryFrom 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.
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.
The post The ed line editor: bravado, utility, and history first appeared on John D. Cook.