Ed Is The Standard Text Editor for Unix/Linux

What the title states is not at all obvious these days, and yet if you look at the man page for ed, it says (and I quote the following): “ed is the ‘standard’ text editor in the sense that it is the original editor for Unix, and thus widely available. For most purposes, however, it is superseded by full-screen editors such as GNU Emacs or GNU Moe.”

Distro Tube writes about this one and even mentions two options I did not know existed: the -p command option to set a prompt, and the :H directive to generate errors in addition to the super terse ?

I checked it out and indeed ed -p “:” thoughts.txt
brings up my file called thoughts.txt and returns a : prompt.

An illegal command generates “Unknown command” if I feed it a b, which is not an ed command. If I say 4000 and my file is not 4000 or more lines long, with the : prompt and the H command implemented, I get the response: “Invalid address”. Before today I did not realize either of these capabilities!

Ed Is the Standard Text Editor for Unix/Linux

5 Likes

I have never heard or seen any indication of the existence of that editor. It may be arrogant on my part, but even after reading the description at Savannah, I feel confident in saying that I can quickly forget about it and not worry of consequences. :slight_smile:



ed is so stripped down, similar to the old MS-DOS EDIT that, for me, it is useless. Yes, I am aware that there are some “use cases” where such a “line editor” is required but, except for back in 1986, I have not come across a single such instance since then!

I will stick to good old vi/GVim, thank you!

:slight_smile:

3 Likes

To be honest, I’ve never used ed often either. However, I did find at least one scenario where I did use it. Here are two examples: one when I was ready to use something else and another admittedly rare case when I actually found it to be useful.

First the “wish I had something else case”. I was new to Unix and I was at a Bell Systems training facility, getting to know Unix. In a lab, all I knew was ed, but I wasn’t very good with it and it’s not all that easy to see what’s on your screen. Fortunately someone showed me vi; though vi isn’t necessarily “easy” in every possible way, I learned just enough keystrokes to get the labs done much easier than with ed.

Okay, so we’ve established that ed is not the most intuitive tool or the most powerful editor, so when might I actually find a use for it? Well, there are other tools to do what I actually got a use, but sometimes they are either not available or they’re difficult to master; that’s where ed turned out to be fine.

I wanted to simply get in and substitute one value for another across a document. Vi may have worked, Perl, sed, awk, or gawk would arguably do a more complete job, but sed can be tricky since the default is stdin and stdout, Perl, awk and gawk are more complicated, but ed has a limited, straightforward command set, so it turned out to be a quick, easy solution.

Could I have used something else, including vi or Emacs? Probably, but doing it with ed was fast, quick and the job was done within a minute or two, so I felt that made it a useful tool for that specific case; can’t honestly say I’ve needed to do that very often, but it sure did come in handy that one time when I had an unusual brain freeze on other approaches!

One other rare scenario is when a system is crippled and a lot of features do not work; most of the time vi is still available, but it’s possible that ed, as a standard utility, may be one of the last things to go. I’ve got a lot of other editors in my arsenal and I hadn’t touched ed in years, but I did try a few things and in the limited capacity of a “line editor” rather than a “screen editor”, it is useful for rare scenarios where a line by line tool is what’s called for. That’d probably be on some ancient 20-40 year old hardware; I have a few friends that actually relish working with these; that ancient stuff might present a few of those rarely seen use cases, other than that, yeah, this is more of a historical thing than a practical every day tool in use today.

The guy I enjoy the most, “Distro Tube”, decided to rank 14 text editing tools, a few of them are IDE (Integrated Development Environments) that include editing, some are just plain text editors.
The Text Editor Tier List (Open Source Editors ONLY!)

Just so you know, DT ranked Atom, Ed, and Gvim as YUCK, though he did rate Emacs, Neovim and Vim as GREAT. This is my update for Tuesday, June 16m since I’ve tacked onto this note a couple of times now!

6 Likes

In the late 90’s early 00’s we used VI to write configs and SED for Cron Job pushes. Usually VI was used for customer circuits like T1’s, DS3’s etc.. But for the GSR1010’s backbone configs SED was the go to. BGP ASN updates, tables, even zone files with Internap. Everything has a purpose, it just depends on the application. Heck, OpenBSD with Linux running on top to me is what Kuber systems should run on. But I cut my teeth on Kermit and KSH was primarily used at that time due to aliase usages. Left the overall game for about a decade for new challanges, AI got me excited again so here I am, a 56 yo learner living mostly in the Cisco world but around since Windows 3.1 server and the 22 floppies it took to install it. Novell infrastructure Admin, OS2 Warp (WHY?) and so on. All that does is make me an old iron dragon (if you know you know) that’s playing a little catch up.

7 Likes

Welcome to the community @ai-integr8tor, great to have you join us! :+1:

3 Likes

Don’t forget the nano editor :joy:

2 Likes

Welcome to our forum community @ai-integr8tor and to the text-editors topics.

For me, by the late nineties to early 2000s I was using GNU Emacs for the majority of my UNIX development work, though I definitely still had vi on my system and I’d occasionally use it for quick editing.

If you go back in the thread I think I’ve mentioned ed, vi, and Emacs many times. I remember the very first time I ever used vi, I was in New Jersey at an AT&T training site learning UNIX and C. I was using the ed text editor, and while I could use it, I found it extremely cumbersome compared to the other text editors I knew at the time. Someone in my class told me that vi was available at the site and told me a few quick vi commands to use; I quickly picked up more and greatly accelerated my editing skills in that class. By the time I took another class (offered by NCR near Dayton, Ohio) I was already quite familiar with both UNIX and C, and was almost “nimble” in my use of both; how time makes matters different!

Yet within a year or two I was using Emacs with at least as much, if not more, direct application and expertise. That’s how it goes once you grasp the fundamentals. By our age, nothing is that difficult - though as you pass retirement age, REMEMBERING the precise details starts getting mixed up every now and then!

3 Likes

Nice, I worked for TCG Cerfnet in San Diego and AT&T bought us in 1999 and because Labs went to Lucent we became the new “Labs” for AT&T. Super fun times, did a tone of stuff for them with the Analog to Digital service and the FIRST data center boom and dark fiber bust. i lived on Cisco gear for a minute and VI was perfect for it. That and SecureCRT, I loved that emulator. Anyways, nothing but Old Iron Dragons when I first got there, but man talk about a treasure trove of knowledge for back then. Majority of the folks were UNIX pimps, even the fellas on the 5E’s. Made me feel kinda dumb half the time. Anyways, I was super lucky to work with some of the folks I was able to work with over the years.

I am super into the AI scene cross functionally which got me interested in tech again. I am a PolyMath so I tend to bounce around with knowledge gaining.
When I publish any papers I will post here as they relate to Either, which will be quite a bit obviously, I am getting my Masters in Science in AI Systems as well as Graduate degree. Apparently I can’t get enough punishment. :grimacing:

4 Likes

It seems to me that you have quite a story to tell yourself.
When it comes to text editors in many cases it’s a matter of background and familiarity. Many text editors get the job done well.

Best wishes to you in everything you do.

2 Likes