Specifications

Chapter 5 Common Command-Line Tasks 35
For general-purpose work, its easiest to deal with one of the text editors included
with Mac OS X. If you want to use a graphical text editor, use TextEdit (in /Applications/);
otherwise, use one of the many command-line editors provided. The three most
full-featured command-line text editors included with Mac OS X are:
nano Nano is a simple command-line based editor. It’s a replacement for the
Pico editor, so instructions for using the Pico editor can be used with nano. If you
invoke the pico editor, you actually run nano. Nano is a good introduction to using
a command-line based editor as it includes easy-to-follow on-screen help.
vim Vim is a vi-compatible text editor. It has many powerful enhancements for
moving around, searching, and editing documents. Basic editing is simple to learn and
there is much additional functionality to explore. Most functionality is accessed by
typing combinations of keystrokes that trigger certain behavior. Vim, or the editor its
modeled after, vi, is found in most UNIX-based operating systems. If you’ll be doing
lots of editing from the command line, it’s a good editor to learn to use, but if you only
use a command-line based editor occasionally, you can get by without learning it.
Emacs Like vim, Emacs is an extremely full-featured editor found on most UNIX-
based systems. In addition to its editing power, Emacs is extremely customizable, with
additional functionality available in modules that let the Emacs interface do much
more than just text editing. It’s relatively easy to do basic editing with, and has an
incredible depth of functionality for the dedicated user to explore. Like vim, Emacs
uses keystroke combinations to access its many dierent functional behaviors. These
require memorization to be most useful, so Emacs is most useful for people who use
the command line very often.
If you’re new to using the command line and don’t anticipate using it much for editing,
nano is probably your best choice. If you expect to spend a lot of time using the
command-line environment, its probably worth learning either vim or Emacs. They
have very dierent design philosophies, so spend some time with each of them to
determine which works best for you. For more information about using nano, vim, or
Emacs, see their man pages.
You invoke a command-line editor by typing the name of the editor, followed by a
space and then the name of the le you want to open. If you want to create a new le,
type a name for the le. Designate where the le is located, as described in Specifying
Files and Folders on page 15. Here’s an example of using nano to open a new le
named “myFile.conf in your Documents folder:
$ nano ~/Documents/myFile.conf