Linux in a NutshellLinux in a NutshellSearch this book

10.4. Summary of Commands by Group

Tables list keystrokes, command name, and description. C- indicates the Ctrl key; M- indicates the Meta key.

10.4.1. File Handling Commands

Binding

Command

Action

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 currently in the buffer.

C-x i

insert-file

Insert file at cursor position.

C-x C-s

save-buffer

Save file. (If terminal hangs, C-q restarts.)

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).

10.4.2. Cursor Movement Commands

In addition to the key bindings shown in this table, you can use the arrow keys to move around in Emacs. When you are running Emacs in a graphical display environment (e.g., in the X Window System), you can also use the mouse for operations such as moving the cursor or selecting text.

Binding

Command

Action

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.

10.4.3. Deletion Commands

Binding

Command

Action

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 Section 10.4.4).

(none)

backward-kill-paragraph

Delete previous paragraph.

(none)

kill-paragraph

Delete from the cursor to the end of the paragraph.

10.4.4. Paragraphs and Regions

Binding

Command

Action

C-@

set-mark-command

Mark the beginning (or end) of a region.

C-Space

(Same as preceding)

(Same as preceding)

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.

M-{

backward-paragraph

Move backward one paragraph.

M-}

forward-paragraph

Move forward one paragraph.

(none)

backward-kill-paragraph

Delete previous paragraph.

(none)

kill-paragraph

Delete from the cursor to the end of the paragraph.

10.4.5. Stopping and Undoing Commands

Binding

Command

Action

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).

10.4.6. Transposition Commands

Binding

Command

Action

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.

10.4.7. Capitalization Commands

Binding

Command

Action

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 initial letters in region.

C-x C-u

upcase-region

Uppercase region.

C-x C-l

downcase-region

Lowercase region.

10.4.8. Incremental Search Commands

Binding

Command

Action

C-s

isearch-forward

Start or repeat incremental search forward.

C-r

isearch-backward

Start or repeat incremental search backward.

Return

(none)

Exit a successful search.

C-g

keyboard-quit

Cancel incremental search; return to starting point.

Del

(none)

Delete incorrect character of search string.

M-C-r

isearch-backward-regexp

Incremental search backward for regular expression.

M-C-s

isearch-forward-regexp

Incremental search forward for regular expression.

10.4.9. Word Abbreviation Commands

Binding

Command

Action

(none)

abbrev-mode

Enter (or exit) word abbreviation mode.

C-x a -

inverse-add-global-abbrev

Define previous word as global (mode-independent) abbreviation.

C-x a i l

inverse-add-mode-abbrev

Define previous word as mode-specific abbreviation.

(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.

10.4.10. Buffer Manipulation Commands

Binding

Command

Action

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.

10.4.11. Window Commands

Binding

Command

Action

C-x 2

split-window-vertically

Divide the current window in two vertically, resulting in one window on top of the other.

C-x 3

split-window-horizontally

Divide the current window in two horizontally, resulting in two side-by-side windows.

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.

10.4.12. Special Shell Mode Characters

The following table shows commands that can be used in Shell mode. To enter Shell mode, run the command M-x shell.

Binding

Command

Action

C-c C-c

interrupt-shell-subjob

Terminate the current job.

C-c C-d

shell-send-eof

End-of-file character.

C-c C-u

kill-shell-input

Erase current line.

C-c C-w

backward-kill-word

Erase the previous word.

C-c C-z

stop-shell-subjob

Suspend the current job.

10.4.13. Indentation Commands

Binding

Command

Action

C-x .

set-fill-prefix

Prepend each line in paragraph with characters from beginning of line up to cursor column; cancel 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-^

delete-indentation

Join this line to the previous line.

M-C-o

split-line

Split line at cursor; indent to column of cursor.

(none)

fill-individual- paragraphs

Reformat indented paragraphs, keeping indentation.

10.4.14. Centering Commands

Binding

Command

Action

(none)

center-line

Center line that cursor is on.

(none)

center-paragraph

Center paragraph that cursor is on.

(none)

center-region

Center currently defined region.

10.4.15. Macro Commands

Binding

Command

Action

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 (

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-last-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.

10.4.16. Detail Information Help Commands

Binding

Command

Action

C-h a

command-apropos

What commands involve this concept?

(none)

apropos

What commands, 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?

10.4.17. Help Commands

Binding

Command

Action

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.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.