Editor choices for Unix

Last revision August 2, 2004

Table of Contents:
  1. Editor choices on Unix
  2. Characteristics, advantages, and disadvantages of vi
  3. Basic text editing operations in vi
  4. Regular expressions
  5. File searching with grep
  6. More about regular expressions
  7. Intermediate text editing with vi
  8. Vi Quick Reference

There are three basic interactive text editors that are found on pangea and commonly on Unix computers throughout the University: vi, pico, and emacs.

In addition to these normal screen editors that let you make changes to text interactively, there is also a streaming editor named sed, which operates on a file in a non-interactive mode according to a set of instructions that you specify on the command line or in a script. It can be used for "canned" editing tasks that must be applied in the same way to many files.


Vi (pronounced "vee-eye") is the standard editor for Unix systems. It is universally available on Unix systems and is be described in detail on these pages.


Many users of pangea and other Unix systems around campus are familiar with the pine email reader program. When you use this program to send email, you have some simple editing commands available to compose your message, such as the ability to delete lines or insert new text at arbitrary locations. This very simple editor that is built into pine is also available as a stand-alone program for general use with the name pico. It is well-suited for the person who only needs to make occasional simple changes to Unix files, such as modifying his .login initialization file.

Pico is so named because it is based on a very tiny subset of the editing commands in the large general purpose editor emacs. The pico editor has six basic features: adding/deleting/changing text, paragraph justification, searching, block cut/paste, a spelling checker, and a file browser.

One of the advantages of pico is that the list of commands you can use is always displayed on the screen, so you never have to remember them, and context-sensitive help is always available.

The style of pico is that you are always in insert mode: typing normal characters just inserts them into the file at the location of the cursor, and the delete (backspace) key simply erases the character immediately before the cursor. The arrow keys on the keyboard move the cursor around on the screen.

More sophisticated functions than simple insertion or deletion of text characters are accomplished with commands that require the use of the CONTROL key. You hold down the CONTROL key like a shift key and then press another key. This is shown in the on-screen command list with a syntax like ^G, where the ^ character stands for the CONTROL key and is followed by the letter G which must also be pressed to run that command.

You start pico from the shell with a simple command that gives the name of the file you want to edit, for example

pico .login

If you want to create a new file, just give the name you want to use for that file as the argument to pico.

Once you are in the pico editor, your screen will be divided into three regions. The top line is a status line that shows the name of the file you are editing. The bottom two lines list the commands that are available for you, including the help command. Everything in between is your window into the file. Move the cursor around with the arrow keys and insert or delete text. Use the CONTROL key commands listed on the screen to move the screen window to another section of file or perform the general editing functions such as cut and paste. Use the help command to get more detailed information on the other commands.


Emacs is a widely used editor available on many types of systems. The GNU version is installed on pangea. This editor is very large and fully programmable with a built-in object oriented language. As a result, it has become more of a shell than an editor. Using "macros", it is possible to do many non-editing functions from within emacs, including compiling and debugging programs and browsing the web.

Emacs is not described in these notes because it is too complicated and bloated for simple editing. Entire books are available to teach emacs.

If you are already familiar with emacs, you can use it on pangea and most other Unix systems on campus. Simply type the shell command


to get started. From an X Window session on pangea, you can use the alternate command name xemacs to open a separate X window for each editing session.

Comments or Questions?