Emacs is a programmer's text processor. Unlike a
word processor, which is concerned about how the text will appear on the
page, a text processor is concerned with high-powered manipulation of text.
Appreciating emacs is an acquired taste and some find it's arcane
command structure daunting. On some UNIX systems, emacs comes with
a command menu system and mouse, similar to most windows-type word processors.
If you have that option, use it (at least at the beginning). In addition,
emacs can always be operated using only key strokes. That's what
we'll concentrate on here.
The best way to get started with emacs is to run the tutorial,
which will take an hour or less. Just start emacs by typing
The opening screen should tell you how to begin the tutorial: type
(that means hold down the "
control" key and press
h" then release "
control") followed by "
That is abbreviated
If you want to learn more about emacs, manuals are available from
the Free Software Foundation. And, within
emacs, you can access the on-line help system by typing
plus an option.
C-h k means "tell me about the following
keystroke command". For example,
C-h k C-x C-c returns
C-x C-c runs the command save-buffers-kill-emacs:
That combination, C-x C-c is the usual way to quit emacs (the standard UNIX convention C-c by itself won't work).
Some commands use the ESC key. On most keyboards, this is just the "
key. The "go to end of file" command is
(press the "
escape" key then hold down the "
key and press the "
." key then release the "
key). Emacs does reward dexterity.
Emacs works with files and buffers. The file is just the usual UNIX file. The buffer is a temporary space in which you manipulate text. You can fill the buffer from a file and you can save the buffer to a file, which is the usual way that a file is edited.
To start emacs and copy a file to a buffer, just include the file name (absolute or relative address). The
starts emacs with the contents of the file
my working directory) in the buffer. If you don't include a file name, emacs
starts with an empty buffer. Before you quit, you have to remember to tell
emacs where to save the buffer.
In window-type environments, text to be moved or altered is often selected by click-dragging the mouse. In emacs, the equivalent is to place a "mark" at the beginning of a selection area and then move the cursor to the other end of the selection region. Then you type in the command you want emacs to apply to the "marked" region. On some, but not all, UNIX systems, the "marked" region will be visibly highlighted on the monitor.
There are a zillion emacs commands, maybe more. The nineteen I find most useful are:
if your keyboard has arrow keys
In emacs, these are called, respectively "copy", "kill",
and "yank". You mark a region using
C-@ (that means
hold down both "
control" and "
as you press "
2") and move the cursor to the other
end of the region. Then "copy" or "kill" the region.
move the cursor to where you want to then "yank" the copied or
Is there a mnemonic for remembering
I haven't found one yet. Isn't it easy to confuse
C-w? Yes. If you make a mistake, yank back the text immediately!