LWN.net Logo

21 of the Best Free Linux Text Editors (LinuxLinks)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 26, 2008 21:18 UTC (Tue) by flewellyn (subscriber, #5047)
Parent article: 21 of the Best Free Linux Text Editors (LinuxLinks)

What about ed?


(Log in to post comments)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 26, 2008 21:32 UTC (Tue) by emk (subscriber, #1128) [Link]

Yay! Three cheers for ed. Because sometimes, your terminal is too broken to run vi. :-)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 26, 2008 22:26 UTC (Tue) by nix (subscriber, #2304) [Link]

The gods require me to link to this, an old classic. (It's scary to realise that vim with all the trimmings is three times the size vi is depicted as, there. How times change...)

(I confess that I have added 'eat flaming death' as an undocumented quit command in various programs I've worked on, in homage.)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 27, 2008 0:10 UTC (Wed) by leoc (subscriber, #39773) [Link]

ed is too bloated

% cat file.txt
(memorize contents of file)
% cat - > file.txt
(retype with changes where necessary)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 27, 2008 3:00 UTC (Wed) by nix (subscriber, #2304) [Link]

Sorry, cat is larger than ed:

-rwxr-xr-x 1 root root 56740 2008-07-12 21:00 /bin/cat
-rwxr-xr-x 2 root root 53485 2008-08-25 18:29 /usr/bin/ed

It's all those GNU features, y'know.

My cat is not bigger than my ed

Posted Aug 27, 2008 3:15 UTC (Wed) by pr1268 (subscriber, #24648) [Link]

me@mybox:~$ ls -l /bin/cat
-rwxr-xr-x 1 root root 17600 2007-06-08 20:12 /bin/cat
me@mybox:~$ ls -l /usr/bin/ed
-rwxr-xr-x 1 root root 37372 2008-04-10 19:58 /usr/bin/ed

It would appear that my cat is smaller than my ed. (Interpret that as you may, but the output above is correct. I'm using Slackware 12.1 with the distro-provided cat and ed. Both binaries are 32-bit ELF LSB x86, stripped.)

My cat is not bigger than my ed

Posted Aug 27, 2008 4:08 UTC (Wed) by nix (subscriber, #2304) [Link]

That's extremely small. I guess the cat isn't stock coreutils cat, but
something BSD, perhaps?

My cat is not bigger than my ed

Posted Aug 27, 2008 4:38 UTC (Wed) by afalko (subscriber, #37028) [Link]

Yes, you are not alone. My cat is also not bigger than my ed:

andrey@kodiak ~ $ ls -l /bin/cat
-rwxr-xr-x 1 root root 30132 Jul 5 01:53 /bin/cat
andrey@kodiak ~ $ ls -l /bin/ed
-rwxr-xr-x 1 root root 39580 Jul 5 01:58 /bin/ed

I don't know about nix, but I feed by cat organic food. pr1268, you need to start feeding your cat more files :).

My cat is not bigger than my ed

Posted Aug 27, 2008 4:45 UTC (Wed) by pr1268 (subscriber, #24648) [Link]

Hehe, I LOL'ed. But, Slackware's (ver. 12.1) cat is from the GNU Coreutils package. And, I promise, I have not fed the cat anything!

My cat is not bigger than my ed

Posted Aug 27, 2008 5:03 UTC (Wed) by nix (subscriber, #2304) [Link]

I guess I need to hunt some bloat in my cat...

... ah, 34Kb of .text and the rest is assorted rubbish like a debuglink
section, EH frame data, and so on. Much of it is padding.

However, my ed only has 28Kb of text!

FWIW size of ed and cat on Slackware 12.1

Posted Aug 27, 2008 5:26 UTC (Wed) by pr1268 (subscriber, #24648) [Link]

me@mybox:~$ size $(which ed) text data bss dec hex filename 33862 1696 604 36162 8d42 /usr/bin/ed me@mybox:~$ size $(which cat) text data bss dec hex filename 15230 460 356 16046 3eae /usr/bin/cat

Granted, size(1) will read through symlinks, and cat(1) in /usr/bin is symlinked to /bin/cat in Slackware 12.1.

FWIW size of ed and cat on Slackware 12.1

Posted Aug 27, 2008 7:21 UTC (Wed) by nix (subscriber, #2304) [Link]

nix@loki 32 /home/nix% size $(which ed)
text data bss dec hex filename
39263 1696 604 41563 a25b /usr/bin/ed
nix@loki 33 /home/nix% size $(which cat)
text data bss dec hex filename
44371 1984 0 46355 b513 /usr/bin/cat
nix@loki 34 /home/nix% cat --version
cat (GNU coreutils) 6.12
[...]

I still have a little game of hunt-the-fat-cat to play.

(size -A, a GNU extension, gives a much more detailed breakdown.)

My cat is not bigger than my ed

Posted Aug 27, 2008 14:37 UTC (Wed) by tjc (guest, #137) [Link]

> It would appear that my cat is smaller than my ed.

Perhaps you should put that in your .sig file. ;)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 27, 2008 2:11 UTC (Wed) by mosfet (guest, #45339) [Link]

From: patl@athena.mit.edu (Patrick J. LoPresti)
Subject: The True Path (long)
Date: 11 Jul 91 03:17:31 GMT
Newsgroups: alt.religion.emacs,alt.slack

When I log into my Xenix system with my 110 baud teletype, both vi
*and* Emacs are just too damn slow.  They print useless messages like,
'C-h for help' and '"foo" File is read only'.  So I use the editor
that doesn't waste my VALUABLE time.

Ed, man!  !man ed

ED(1)               Unix Programmer's Manual                ED(1)

NAME
     ed - text editor

SYNOPSIS
     ed [ - ] [ -x ] [ name ]
DESCRIPTION
     Ed is the standard text editor.
---

Computer Scientists love ed, not just because it comes first
alphabetically, but because it's the standard.  Everyone else loves ed
because it's ED!

"Ed is the standard text editor."

And ed doesn't waste space on my Timex Sinclair.  Just look:

-rwxr-xr-x  1 root          24 Oct 29  1929 /bin/ed
-rwxr-xr-t  4 root     1310720 Jan  1  1970 /usr/ucb/vi
-rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs

Of course, on the system *I* administrate, vi is symlinked to ed.
Emacs has been replaced by a shell script which 1) Generates a syslog
message at level LOG_EMERG; 2) reduces the user's disk quota by 100K;
and 3) RUNS ED!!!!!!

"Ed is the standard text editor."

Let's look at a typical novice's session with the mighty ed:

golem$ ed

?
help
?
?
?
quit
?
exit
?
bye
?
hello? 
?
eat flaming death
?
^C
?
^C
?
^D
?

---
Note the consistent user interface and error reportage.  Ed is
generous enough to flag errors, yet prudent enough not to overwhelm
the novice with verbosity.

"Ed is the standard text editor."

Ed, the greatest WYGIWYG editor of all.

ED IS THE TRUE PATH TO NIRVANA!  ED HAS BEEN THE CHOICE OF EDUCATED
AND IGNORANT ALIKE FOR CENTURIES!  ED WILL NOT CORRUPT YOUR PRECIOUS
BODILY FLUIDS!!  ED IS THE STANDARD TEXT EDITOR!  ED MAKES THE SUN
SHINE AND THE BIRDS SING AND THE GRASS GREEN!!

When I use an editor, I don't want eight extra KILOBYTES of worthless
help screens and cursor positioning code!  I just want an EDitor!!
Not a "viitor".  Not a "emacsitor".  Those aren't even WORDS!!!! ED!
ED! ED IS THE STANDARD!!!

TEXT EDITOR.

When IBM, in its ever-present omnipotence, needed to base their
"edlin" on a Unix standard, did they mimic vi?  No.  Emacs?  Surely
you jest.  They chose the most karmic editor of all.  The standard.

Ed is for those who can *remember* what they are working on.  If you
are an idiot, you should use Emacs.  If you are an Emacs, you should
not be vi.  If you use ED, you are on THE PATH TO REDEMPTION.  THE
SO-CALLED "VISUAL" EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE
FAITHLESS.  DO NOT GIVE IN!!!  THE MIGHTY ED HAS SPOKEN!!!

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 27, 2008 3:04 UTC (Wed) by nix (subscriber, #2304) [Link]

I posted that four or five hours ago.

And you missed the

?

at the very end, perhaps the funniest part of a very funny post.

(The mighty ed has spoken, and what did it say? What would you expect it
to say?)

?

GNU ed 1.0 was released last week

Posted Aug 27, 2008 11:01 UTC (Wed) by coriordan (guest, #7544) [Link]

I don't know how many years it was in development, but version 1.0 of GNU ed came out August 21st 2008. There's not much additional info on the GNU ed page.

GNU ed 1.0 was released last week

Posted Aug 27, 2008 11:52 UTC (Wed) by nix (subscriber, #2304) [Link]

From NEWS, it seems this is seriously radical stuff:

The option "--program-prefix" has been added to the configure script.

A buffer overflow has been fixed.

GNU ed 1.0 was released last week

Posted Aug 30, 2008 18:15 UTC (Sat) by bryanr (guest, #25324) [Link]

A buffer overflow, in ed, in 2008? Computer security is such an amusing and depressing reflection of mankind

GNU ed 1.0 was released last week

Posted Aug 31, 2008 11:34 UTC (Sun) by nix (subscriber, #2304) [Link]

Hey, look on the good side: it's unlikely anyone exploited it :)

(my mother just stopped using Windows 3.1, jumping to XP and Ubuntu. It
probably reduced her overall security because her Win3.1 box was
effectively exploitation-proof... I mean, who even looks for exploits on a
system that old?)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 27, 2008 17:07 UTC (Wed) by AJWM (guest, #15888) [Link]

'ed' is perfect for scripting a series of edits on a bunch of files where sed or awk or perl would be too arcane or bloated (or you've forgotten the exact sed or awk or perl syntax). Quick'n'dirty but it gets the job done, emphasis on quick.

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 28, 2008 0:37 UTC (Thu) by flewellyn (subscriber, #5047) [Link]

I'm more proficient with sed than ed, myself. I find it very useful, though.

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 29, 2008 9:17 UTC (Fri) by branden (guest, #7029) [Link]

ed is a more appropriate tool than sed for noninteractive editing when the file to be manipulated is free-form and/or you need to go backwards.

I wouldn't rule anything as beyond sed's capabilities, since thanks to its hold buffer, label and branching features, it's probably Turing-complete. But I think ed is a better (and more idiomatic) fit for the scenarios I mentioned.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds