Emacs Cheat Sheet
Starting emacs from the Unix prompt
-
% emacs
-
to start emacs.
-
% emacs filename
-
to start emacs and load a file
-
% emacs -nw filename
-
to start emacs with no new window (load file)
Help
-
H T
-
to see the tutorial
-
H A topic
-
to see help about topic
-
X U
-
undo the last command
Cursor Positioning
-
F or
-
forward (right) one character.
-
B or
-
back (left) one character
-
P or
-
up one character
-
N or
-
down one character
-
B
-
left one word
-
F
-
right one word
-
A
-
to beginning of line
-
E
-
to end of line
-
<
-
start of document
-
>
-
end of document
-
V
-
page up
-
V
-
page down
-
L
-
cursor in middle of screen
-
U
20
N
-
advance 20 lines
-
X
what-line
-
display the line number where the cursor is located
-
<
U 999
N
-
go to line number 999
Search and Replace
-
S patterntext
-
search for patterntext; cursor moves as you type. Press
once at the correct location
-
S
-
search for the next occurrence
-
S
%
oldstring
newstring
-
Search for oldstring and replace it with newstring.
The Y key confirms each replacement
Loading and Saving
X
F
filename
-
create new filename for editing (clears workspace)
-
X
F
filename
-
load in filename for editing
-
X
W
filename
-
write (save) as filename
-
X
S
-
resave under the current filename (based on above
or name given when starting emacs)
Quitting and Suspending
-
Z
-
suspend current program (This is actually a Unix directive to any
program; emacs does not understand
Z
per se.)
-
X
C
-
quit emacs (Can be used with impunity -- the system will
prompt if the workspace has not yet been saved.)