UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 7.1 IntroductionChapter 7
The Emacs Editor
Next: 7.3 Summary of Commands by Key
 

7.2 Summary of Commands by Group

Reminder: C- indicates the Control key; M- indicates the Meta key.

7.2.1 File-Handling Commands

KeystrokesCommand NameDescription

C-x C-f

find-file

Find file and read it.

C-x C-v

find-alternate-file

Read another file; replace the one read with C-x C-f.

C-x i

insert-file

Insert file at cursor position.

C-x C-s

save-buffer

Save file (may hang terminal; use C-q to restart).

C-x C-w

write-file

Write buffer contents to file.

C-x C-c

save-buffers-kill-emacs

Exit emacs.

C-z

suspend-emacs

Suspend emacs (use exit or fg to restart).

7.2.2 Cursor-Movement Commands

KeystrokesCommand NameDescription

C-f

forward-char

Move forward one character (right).

C-b

backward-char

Move backward one character (left).

C-p

previous-line

Move to previous line (up).

C-n

next-line

Move to next line (down).

M-f

forward-word

Move one word forward.

M-b

backward-word

Move one word backward.

C-a

beginning-of-line

Move to beginning of line.

C-e

end-of-line

Move to end of line.

M-a

backward-sentence

Move backward one sentence.

M-e

forward-sentence

Move forward one sentence.

M-{

backward-paragraph

Move backward one paragraph.

M-}

forward-paragraph

Move forward one paragraph.

C-v

scroll-up

Move forward one screen.

M-v

scroll-down

Move backward one screen.

C-x [

backward-page

Move backward one page.

C-x ]

forward-page

Move forward one page.

M->

end-of-buffer

Move to end of file.

M-<

beginning-of-buffer

Move to beginning of file.

(none)

goto-line

Go to line n of file.

(none)

goto-char

Go to character n of file.

C-l

recenter

Redraw screen with current line in the center.

M-n

digit-argument

Repeat the next command n times.

C-u n

universal-argument

Repeat the next command n times.

7.2.3 Deletion Commands

Keystrokes

Command Name

Description

Del

backward-delete-char

Delete previous character.

C-d

delete-char

Delete character under cursor.

M-Del

backward-kill-word

Delete previous word.

M-d

kill-word

Delete the word the cursor is on.

C-k

kill-line

Delete from cursor to end of line.

M-k

kill-sentence

Delete sentence the cursor is on.

C-x Del

backward-kill-sentence

Delete previous sentence.

C-y

yank

Restore what you've deleted.

C-w

kill-region

Delete a marked region (see next section).

(none)

backward-kill-paragraph

Delete previous paragraph.

(none)

kill-paragraph

Delete from the cursor to the end of the paragraph.

7.2.4 Paragraphs and Regions

Keystrokes

Command Name

Description

C-@

set-mark-command

Mark the beginning (or end) of a region.

C-Space

(same as above)

 

C-x C-p

mark-page

Mark page.

C-x C-x

exchange-point-and-mark

Exchange location of cursor and mark.

C-x h

mark-whole-buffer

Mark buffer.

M-q

fill-paragraph

Reformat paragraph.

(none)

fill-region

Reformat individual paragraphs within a region.

M-h

mark-paragraph

Mark paragraph.

7.2.5 Stopping and Undoing Commands

Keystrokes

Command Name

Description

C-g

keyboard-quit

Abort current command.

C-x u

advertised-undo

Undo last edit (can be done repeatedly).

(none)

revert-buffer

Restore buffer to the state it was in when the file was last saved (or auto-saved).

7.2.6 Transposition Commands

Keystrokes

Command Name

Description

C-t

transpose-chars

Transpose two letters.

M-t

transpose-words

Transpose two words.

C-x C-t

transpose-lines

Transpose two lines.

(none)

transpose-sentences

Transpose two sentences.

(none)

transpose-paragraphs

Transpose two paragraphs.

7.2.7 Capitalization Commands

Keystrokes

Command Name

Description

M-c

capitalize-word

Capitalize first letter of word.

M-u

upcase-word

Uppercase word.

M-l

downcase-word

Lowercase word.

M--; M-c

negative-argument; capitalize-word

Capitalize previous word.

M-- M-u

negative-argument; upcase-word

Uppercase previous word.

M-- M-l

negative-argument; downcase-word

Lowercase previous word.

(none)

capitalize-region

Capitalize region.

C-x C-u

upcase-region

Uppercase region

C-x C-l

downcase-region

Lowercase region.

7.2.8 Word-Abbreviation Commands

Keystrokes

Command Name

Description

(none)

abbrev-mode

Enter (or exit) word abbreviation mode.

C-x a i g

inverse-add-global-abbrev

Type global abbreviation, then definition.

C-x a i l

inverse-add-local-abbrev

Type local abbreviation, then definition.

(none)

unexpand-abbrev

Undo the last word abbreviation.

(none)

write-abbrev-file

Write the word abbreviation file.

(none)

edit-abbrevs

Edit the word abbreviations.

(none)

list-abbrevs

View the word abbreviations.

(none)

kill-all-abbrevs

Kill abbreviations for this session.

7.2.9 Buffer-Manipulation Commands

Keystrokes

Command Name

Description

C-x b

switch-to-buffer

Move to specified buffer.

C-x C-b

list-buffers

Display buffer list.

C-x k

kill-buffer

Delete specified buffer.

(none)

kill-some-buffers

Ask about deleting each buffer.

(none)

rename-buffer

Change buffer name to specified name.

C-x s

save-some-buffers

Ask whether to save each modified buffer.

7.2.10 Window Commands

Keystrokes

Command Name

Description

C-x 2

split-window-vertically

Divide the current window into two, one on top of the other.

C-x 3

split-window-horizontally

Divide the current window into two, side by side.

C-x >

scroll-right

Scroll the window right.

C-x <

scroll-left

Scroll the window left.

C-x o

other-window

Move to the other window.

C-x 0

delete-window

Delete current window.

C-x 1

delete-other-windows

Delete all windows but this one.

(none)

delete-windows-on

Delete all windows on a given buffer.

C-x ^

enlarge-window

Make window taller.

(none)

shrink-window

Make window shorter.

C-x }

enlarge-window-horizontally

Make window wider.

C-x {

shrink-window-horizontally

Make window narrower.

M-C-v

scroll-other-window

Scroll other window.

C-x 4 f

find-file-other-window

Find a file in the other window.

C-x 4 b

switch-to-buffer-other-window

Select a buffer in the other window.

C-x 5 f

find-file-other-frame

Find a file in a new frame.

C-x 5 b

switch-to-buffer-other-frame

Select a buffer in another frame.

(none)

compare-windows

Compare two buffers; show first difference.

7.2.11 Special Shell Characters

Keystrokes

Command Name

Description

C-c C-c

comint-interrupt-subjob

Terminate the current job.

C-c C-d

comint-send-eof

End of file character.

C-c C-u

comint-kill-input

Erase current line.

C-c C-w

backward-kill-word

Erase the previous word.

C-c C-z

comint-stop-subjob

Suspend the current job.

7.2.12 Indentation Commands

Keystrokes

Command Name

Description

C-x .

set-fill-prefix

Use characters from the beginning of the line up to the cursor column as the "fill prefix." This prefix is prepended to each line in the paragraph. Cancel the prefix by typing this command in column 1.

(none)

indented-text-mode

Major mode: each tab defines a new indent for subsequent lines.

(none)

text-mode

Exit indented text mode; return to text mode.

M-C-\

indent-region

Indent a region to match first line in region.

M-m

back-to-indentation

Move cursor to first character on line.

M-C-o

split-line

Split line at cursor; indent to column of cursor.

(none)

fill-individual-paragraphs

Reformat indented paragraphs, keeping indentation.

7.2.13 Centering Commands

Keystrokes

Command Name

Description

M-s

center-line

Center line that cursor is on.

(none)

center-paragraph

Center paragraph that cursor is on.

(none)

center-region

Center currently defined region.

7.2.14 Macro Commands

Keystrokes

Command Name

Description

C-x (

start-kbd-macro

Start macro definition.

C-x )

end-kbd-macro

End macro definition.

C-x e

call-last-kbd-macro

Execute last macro defined.

M-n C-x e

digit-argument and call-last-kbd-macro

Execute last macro defined n times.

C-u C-x (

universal-argument and start-kbd-macro

Execute last macro defined, then add keystrokes.

(none)

name-last-kbd-macro

Name last macro you created (before saving it).

(none)

insert-keyboard-macro

Insert the macro you named into a file.

(none)

load-file

Load macro files you've saved.

(none)

macroname

Execute a keyboard macro you've saved.

C-x q

kbd-macro-query

Insert a query in a macro definition.

C-u C-x q

(none)

Insert a recursive edit in a macro definition.

M-C-c

exit-recursive-edit

Exit a recursive edit.

7.2.15 Basic Indentation Commands

Keystrokes

Command Name

Description

M-C-\

indent-region

Indent a region to match first line in region.

M-m

back-to-indentation

Move to first non-blank character on line.

M-^

delete-indentation

Join this line to the previous one.

7.2.16 Detail Information Help Commands

Keystrokes

Command Name

Description

C-h a

command-apropos

What commands involve this concept?

(none)

apropos

What functions and variables involve this concept?

C-h c

describe-key-briefly

What command does this keystroke sequence run?

C-h b

describe-bindings

What are all the key bindings for this buffer?

C-h k

describe-key

What command does this keystroke sequence run, and what does it do?

C-h l

view-lossage

What are the last 100 characters I typed?

C-h w

where-is

What is the key binding for this command?

C-h f

describe-function

What does this function do?

C-h v

describe-variable

What does this variable mean, and what is its value?

C-h m

describe-mode

Tell me about the mode the current buffer is in.

C-h s

describe-syntax

What is the syntax table for this buffer?

7.2.17 Help Commands

Keystrokes

Command Name

Description

C-h t

help-with-tutorial

Run the emacs tutorial.

C-h i

info

Start the Info documentation reader.

C-h n

view-emacs-news

View news about updates to emacs.

C-h C-c

describe-copying

View the emacs General Public License.

C-h C-d

describe-distribution

View information on ordering emacs from the FSF.

C-h C-w

describe-no-warranty

View the (non-)warranty for emacs.


Previous: 7.1 IntroductionUNIX in a Nutshell: System V EditionNext: 7.3 Summary of Commands by Key
7.1 IntroductionBook Index7.3 Summary of Commands by Key

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System