Back to 212 Main Page

Mobius strip

Unix Editor Bare Essentials

If you are editing text on Unix, it is likely either vi, pico, or emacs will be available there. These are the most widespread editors, though there are many other text editors available on Unix as well. However, many of them are subsets or clones of these three. The table below will teach you the most essential commands you need to use each editor: how to open a file, edit it, and then exit (and either save or discard your changes).

vipico emacs
Strengthavailable even on simple/"low-tech" servers simple to learn, easy to use powerful and extensible
Weakness different ("strange") editing paradigm; need to know keystrokes too simple/basic for heavy use need to know complex keystrokes; requires a lot of system resources
Command to open a file vi filename pico filename emacs filename
To move cursor Use arrow keys
(or h, j, k, l)
Use arrow keys
(or ^F, ^B, ^N, ^P)
Use arrow keys
(or ^F, ^B, ^N, ^P)
To start editing text Type a (append) or i (insert) or s (substitute), then type. Type ESC to stop text input mode. Just start typing Just start typing
To delete Character: x
Line: dd
Character: Del
Line: ^K
Character: Del
Line: ^K
To save file :w ^O ^X ^S
To quit :q
:q! to force quit, discarding changes
ZZ to quit, saving any changes
^X (answer yes or no to save changes) ^X ^C (answer yes or no to save changes)

KEY: ^X == Ctrl-x == "hold down Control and press x"

To learn more about these editors, consult their respective man pages, tutorials, or menus.

~ztomasze Index : TA Details : ICS212 : Unix Editors
Last Edited: 11 Jan 2006
©2004 by Z. Tomaszewski.