ed text editor and mr. ed

I have always had historic interest of various UNIX tools and the UNIX itself. One day when I was learning sed, the stream editor, (sed cheat sheet) I got interested how much the most powerful text editing tools on UNIX - 'ed', 'ex', 'sed' and 'vim' (or just 'vi') had in common and what they borrowed from one another.

I was not perfectly sure if 'sed' has originated from 'ed', so I Google searched for 'sed history' which turned up some interesting results, one of them being "The original users manual for sed, by Lee E. McMahon, from the 7th edition UNIX Manual (1978)".

Quoting the manual "Sed is a lineal descendant of the UNIX editor, ed." Great! I knew that 'sed' was non-interactive text editor whereas 'ed' was an interactive one. Also I knew that 'ex' was improved 'ed' and that 'sed' was a non-interactive 'ed' and that 'ex' had become 'vi' and was used in 'vi' command line mode. To boost my vi/vim skills and get a touch on how text editing was done with just 'ed', and satisfy my historical curiosity I set myself a goal to learn it.

As I mentioned in awk and sed cheat sheet posts, the best method for me to learn a new tool is to have all commands in front of me, so when I am doing experimentation I can quickly find the command and also see all the other commands at the same time, blowing them in subconsciousness.

Since 'ed' is line-oriented text editor, it is important to understand the line addressing, this cheat sheet summarizes the line addressing.

Most of 'ed' command are single letter in length. This cheat sheet summarizes all the commands, showing the supported address ranges and a detailed description of each command.

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.

Good luck with learning ed! :)


ps. if you notice any inaccuracies, spelling or grammar errors, please leave a comment here, so I can fix it. Thanks!
pss. logo for this article from mr. ed comedy ;)

Download Ed UNIX Text Editor's Cheat-Sheet

Plain Text (.txt):
Download link: ed text editor cheat sheet (.txt)
Downloaded: 18964 times

Download link: ed text editor cheat sheet (.pdf)
Downloaded: 31513 times

Microsoft Word 2000 format (.doc):
Download link: ed text editor cheat sheet (.doc)
Downloaded: 3084 times


Peter Crouch Permalink
September 04, 2008, 22:27

Personally I prefer this plain and simple old school text editor:

September 11, 2008, 10:11

Seriously ? you're learning ED in the 21st century ?
(oh my).
Now, maybe ED is way more powerful than EDLIN, the ED-inspired editor of MS-DOS 3 which i have been forced to use in early days ... I can tell you it *really* made me regret the C64's BASIC edition mode (list 1-n giving you n first lines, and re-typing over existing lines replaced them).

kilves76 Permalink
July 30, 2012, 04:24

The point of learning ed is to become better in using (g)vi(m). When you know the history (ed>ex>vi) of the command you use, the commands will make more sense.

(yes i know i'm replying to a 4 year old post...)

August 25, 2013, 07:32

electric coffee roaster Nesco Cr1010pr Roaster Coffee Bean 800W Deluxe Pro

September 23, 2013, 17:43

The Emperor’s New Groove – The New Groove Edition By:

Ogre Permalink
February 10, 2009, 19:16

I was looking for an rtf viewer/editor for unix and had to stop by. I frequently use ed when building ad-hoc scripts. It is the ONLY editor that enables me to change the second occurance(or 3rd) of an RE. Ex and vi change the number of occurances starting with the first. For example: Applying the same sed-script to 99 files and directing the output to a different directory, I need to change the second directory. I usually use ls to find the files I want, past the list to itself, insert 'sed -f changes' in front of each file, then change the second(output) directory. ed is the only way to change the second directory name. In 60 seconds, plus the time to build whatever sed script I need for these files, I have them changed and in another directory.

Adrian Permalink
May 25, 2009, 19:38

Yes, ed is a small, powerful tool – if you know how (and when!) to use it wisely, it can certainly save the day. But somehow I wonder (please don’t get me wrong on that): Why did you compile the cheat sheet? In my humble opinion, the manpage is basically just as good. (It is slightly longer, but it also covers a few more issues.) If you prefer to read it on paper, you can run

man -t ed

to have the manpage pretty-printed as PostScript. Redirect the output into a file, or pipe it directly to the printer.

christophe Permalink
September 07, 2010, 09:26

Hi! Do you know if there is multiple implementation of ed ? Thanks ;)

January 18, 2011, 05:58

plz send me ex and ed editors program in unix

UNIXgod Permalink
April 26, 2011, 05:22

Kumar if your distro does not contain ex and ed check out FreeBSD. It's historically accurate.

March 28, 2014, 09:09

yes thanks so much

April 08, 2014, 10:37

So cool will be using that tips

April 08, 2014, 10:37

So cool will be using that tips

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Please preview the comment before submitting to make sure it's OK.