Hacker Newsnew | comments | show | ask | jobs | submit login

As a sysadmin, you have to be capable of quickly editing files no matter what or whose machine you're on.

This means that you often don't have the luxury of installing anything on the machine you find yourself on. You might find yourself on a small Linux-based router that only has busybox on it. This is the case for many resource-starved VPS' and other small Linux installs as well. Busybox comes with vi, but not with emacs (or even vim). If a sysadmin finds himself on one of these, he simply has to make do with what he has. He may not have the time, or an internet connection, or the authority to install anything at all. So familiarity with vi in these circumstances is essential.

On very few machines will the situation be reversed: with emacs or mg available and vi not (I have never run in to such a case). So a sysadmin has little incentive to learn or install emacs.

As for mg, even if you could install it, I'm really not sure what it would buy you over vanilla vi. In the kinds of resource-starved environments where you'd actually prefer mg over emacs, you wouldn't want to spend a lot of time editing anything. A quick in and out edit should really be all you could reasonably be expected to do in such a situation... and that could probably be done equally well with either mg or vi.




vi is part of POSIX (the UNIX standard):

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi...

emacs is not

So it's not surprising you find vi more places than emacs.

Tim O'Reilly wrote that ORA sold twice as many vi books as emacs. (http://oreilly.com/pub/a/oreilly/ask_tim/1999/unix_editor.ht...)

In 15 years as a sysadmin, I've never seen a machine that had emacs but not vi. :) Though I agree it's theoretically possible. In which case, knowing ed would get you going quickly. Knowing ed can speed up your work in vi, too, you can handle large amounts of text quickly using short powerful ed commands. (for example, write everything from the start of the file to the current line to file /tmp/save.txt: 1,.w /tmp/save.txt Or delete all lines that have a curly brace: g/{/d)

Peteris's excellent ed sheetsheet: http://www.catonmat.net/blog/ed-unix-text-editor-cheat-sheet...

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: