home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

UNIX in a Nutshell: System V Edition

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

7.2 Summary of Commands by Group

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

7.2.1 File-handling Commands

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

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

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

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.
M-q fill-region Reformat individual paragraphs within a region.
M-h mark-paragraph Mark paragraph.

7.2.5 Stopping and Undoing Commands

C- 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

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

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 Incremental Search Commands

C-s isearch-forward Start incremental search forward.
C-r isearch-backward Start incremental search backward.
Meta (none) Exit a successful search.
C-g keyboard-quit Cancel incremental search; return to starting point.
DEL (none) Delete incorrect character of search string.

7.2.9 Word Abbreviation Commands

(none) abbrev-mode Enter (or exit) word abbreviation mode.
C-x - inverse-add-lobal-abbrev Type global abbreviation, then definition.
C-x C-h 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.10 Buffer Manipulation Commands

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.11 Window Commands

C-x 2 split-window-horizontally Divide the current window horizontally into two.
C-x 5 split-window-vertically Divide the current window vertically into two.
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.
(none) compare-windows Compare two buffers; show first difference.

7.2.12 Special Shell Characters

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.

7.2.13 Indentation Commands

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-C-o split-line Split line at cursor; indent to column of cursor.
(none) fill-individual- paragraphs Reformat indented paragraphs, keeping indentation.

7.2.14 Centering Commands

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.15 Macro Commands

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.

7.2.16 Basic Indentation Commands

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.17 Detail Information Help Commands

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.18 Help Commands

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 FSF.
C-h C-w describe-no-warranty View the (non-)warranty for emacs.

Previous: 7.1 Introduction UNIX in a Nutshell: System V Edition Next: 7.3 Summary of Commands by Key
7.1 Introduction Book Index 7.3 Summary of Commands by Key

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