1.12 Text Editors

1.12 Text Editors

Speaking of editing, it's time for you to learn an editor. To get serious with Unix, you must be able to edit text files without damaging them. Most parts of the system use plain-text configuration files (for example, those in /etc). It's not too difficult to edit files, but you will do it so often that you need a serious, powerful tool for the job.

You should make a serious attempt to learn one of the two de facto standard Unix text editors, vi and emacs. Most Unix wizards are religious about their choice of editor. Don't listen to them. Instead, choose for yourself. If you choose an editor that matches your personality, you will find it easier to learn.

  • If you want an editor that can do almost anything and has extensive online help, and you don't mind doing some extra typing to get these features, try emacs.

  • If speed means everything to you, give vi a shot; it "plays" a bit like a video game.

Learning the vi Editor [Lamb] can tell you everything you need to know about vi. For emacs, use the online tutorial: Start emacs from the shell prompt or a GUI menu, type CONTROL-H, and then type t. If you want a book, look at GNU Emacs Manual [Stallman].

You might be tempted to bumble around with a "friendlier" editor, such as pico or one of the myriad GUI editors when you first start out, but if you're the type of person who tends to make a habit out of the first thing that you use, you don't want to go down this route.

Incidentally, the editing text is where you will first start to see a difference between the terminal and the GUI. Editors such as vi run inside the terminal window, using the standard terminal I/O interface that you are now starting to learn. However, GUI editors start their own window and present their own interface, independent of terminals.