Topics Map > University of Chicago > IT Services > Applications, Operating Systems, & Devices
Basic Unix - Editing Files
This article describes file editing in the Unix operating system.
If you spend any time on a Unix system, you'll want to become comfortable with a text editor. You may want to edit your configuration files, make quick changes to a web page, edit a script you've created, or simply jot yourself some notes: all these activities are easily done with a command line text editor.
In the beginning, Unix had only one editor, the line-by-line editor "ed". A medieval version of Unix contained a new program called "ex"; its most notable feature was allowing people to work with a full screen of text by giving the command "vi". The new display editor proved so popular that AT&T's Unix System V included vi as a separate program.
Since then, vi has remained as a standard command line editor, but two others have emerged: emacs, a full-featured text-editor, and the easy to use pico. This document provides a brief introduction to each and references for how to learn more.
The chief advantage of vi is that, as a standard Unix full-screen editor, it is likely to exist on any Unix machine you work on. (`Vi' is an abbreviation for the "Visual Implementation" of an older Unix editor.) It has also occasionally been seen to work faster, when system loads are high, than other editors. But underneath, vi is still a glorified line editor and lacks many useful features.
Our article, Unix - Using Vi, lists the basic vi commands. After you have read it and practiced for a short time at your terminal, you should be able to do basic editing with vi. If you want to use some of vi's more complicated resources, we recommend a close study of the man pages.
Emacs is a very powerful text editor which has so many bells and whistles that it has a largely undeserved reputation for being slow as well (the joke is that `emacs' stands for "emacs makes a computer slow"). Emacs has many specialized features for such tasks as editing program code, it's complicated enough that it can be difficult to learn on your own. Instead, run the (excellent) emacs tutorial by typing, at your Unix prompt:
In the Emacs reference Unix - Using Emacs, you'll find a summary of the most commonly used commands in emacs. If you find yourself stuck in emacs, "^-x^-c" (control-x followed by control-c) will get you out and back to the Unix prompt, or whatever you entered emacs from.
Pico is the easiest of the popular Unix text editors to learn and is a good place to start if you're just getting your feet wet. In fact, since you're probably using a full word processor for most of your text tasks, pico may provide all the features for the type of editing you are ever going to do on the command line.
For a quick introduction, read our Unix - Using Pico documentation.