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: 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-ffind-fileFind file and read it.
C-x C-vfind-alternate-fileRead another file; replace the one read with C-x C-f.
C-x iinsert-fileInsert file at cursor position.
C-x C-ssave-bufferSave file (may hang terminal; use C-q to restart).
C-x C-wwrite-fileWrite buffer contents to file.
C-x C-csave-buffers-kill-emacsExit emacs.
C-zsuspend-emacsSuspend emacs (use exit or fg to restart).

7.2.2 Cursor Movement Commands

C-fforward-charMove forward one character (right).
C-bbackward-charMove backward one character (left).
C-pprevious-lineMove to previous line (up).
C-nnext-lineMove to next line (down).
M-fforward-wordMove one word forward.
M-bbackward-wordMove one word backward.
C-abeginning-of-lineMove to beginning of line.
C-eend-of-lineMove to end of line.
M-abackward-sentenceMove backward one sentence.
M-eforward-sentenceMove forward one sentence.
M-[backward-paragraphMove backward one paragraph.
M-]forward-paragraphMove forward one paragraph.
C-vscroll-upMove forward one screen.
M-vscroll-downMove backward one screen.
C-x [backward-pageMove backward one page.
C-x ]forward-pageMove forward one page.
M->end-of-bufferMove to end of file.
M-<beginning-of-bufferMove to beginning of file.
(none)goto-lineGo to line n of file.
(none)goto-charGo to character n of file.
C-lrecenterRedraw screen with current line in the center.
M-ndigit-argumentRepeat the next command n times.
C-u nuniversal-argumentRepeat the next command n times.

7.2.3 Deletion Commands

DELbackward-delete-charDelete previous character.
C-ddelete-charDelete character under cursor.
M-DELbackward-kill-wordDelete previous word.
M-dkill-wordDelete the word the cursor is on.
C-kkill-lineDelete from cursor to end of line.
M-kkill-sentenceDelete sentence the cursor is on.
C-x DELbackward-kill-sentenceDelete previous sentence.
C-yyankRestore what you've deleted.
C-wkill-regionDelete a marked region (see next section).
(none)backward-kill-paragraphDelete previous paragraph.
(none)kill-paragraphDelete from the cursor to the end of the paragraph.

7.2.4 Paragraphs and Regions

C-@set-mark-commandMark the beginning (or end) of a region.
C-SPACE(same as above)
C-x C-pmark-pageMark page.
C-x C-xexchange-point-and-markExchange location of cursor and mark.
C-x hmark-whole-bufferMark buffer.
M-qfill-paragraphReformat paragraph.
M-qfill-regionReformat individual paragraphs within a region.
M-hmark-paragraphMark paragraph.

7.2.5 Stopping and Undoing Commands

C-keyboard-quitAbort current command.
C-x uadvertised-undoUndo last edit (can be done repeatedly).

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

7.2.6 Transposition Commands

C-ttranspose-charsTranspose two letters.
M-ttranspose-wordsTranspose two words.
C-x C-ttranspose-linesTranspose two lines.
(none)transpose-sentencesTranspose two sentences.
(none)transpose-paragraphsTranspose two paragraphs.

7.2.7 Capitalization Commands

M-ccapitalize-wordCapitalize first letter of word.
M-uupcase-wordUppercase word.
M-ldowncase-wordLowercase 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-regionCapitalize region.
C-x C-uupcase-regionUppercase region
C-x C-ldowncase-regionLowercase region.

7.2.8 Incremental Search Commands

C-sisearch-forwardStart incremental search forward.
C-risearch-backwardStart incremental search backward.
Meta(none)Exit a successful search.
C-gkeyboard-quitCancel incremental search; return to starting point.
DEL(none)Delete incorrect character of search string.

7.2.9 Word Abbreviation Commands

(none)abbrev-modeEnter (or exit) word abbreviation mode.
C-x -inverse-add-lobal-abbrevType global abbreviation, then definition.
C-x C-hinverse-add-local-abbrevType local abbreviation, then definition.
(none)unexpand-abbrevUndo the last word abbreviation.
(none)write-abbrev-fileWrite the word abbreviation file.
(none)edit-abbrevsEdit the word abbreviations.
(none)list-abbrevsView the word abbreviations.
(none)kill-all-abbrevsKill abbreviations for this session.

7.2.10 Buffer Manipulation Commands

C-x bswitch-to-bufferMove to specified buffer.
C-x C-blist-buffersDisplay buffer list.
C-x kkill-bufferDelete specified buffer.
(none)kill-some-buffersAsk about deleting each buffer.
(none)rename-bufferChange buffer name to specified name.
C-x ssave-some-buffersAsk whether to save each modified buffer.

7.2.11 Window Commands

C-x 2split-window-horizontallyDivide the current window horizontally into two.
C-x 5split-window-verticallyDivide the current window vertically into two.
C-x >scroll-rightScroll the window right.
C-x <scroll-leftScroll the window left.
C-x oother-windowMove to the other window.
C-x 0delete-windowDelete current window.
C-x 1delete-other-windowsDelete all windows but this one.
(none)delete-windows-onDelete all windows on a given buffer.
C-x ^enlarge-windowMake window taller.
(none)shrink-windowMake window shorter.
C-x }enlarge-window-horizontallyMake window wider.
C-x {shrink-window-horizontallyMake window narrower.
M-C-vscroll-other-windowScroll other window.
C-x 4 ffind-file-other-windowFind a file in the other window.
C-x 4 bswitch-to-buffer-other-windowSelect a buffer in the other window.
(none)compare-windowsCompare two buffers; show first difference.

7.2.12 Special Shell Characters

C-c C-cinterrupt-shell-subjobTerminate the current job.
C-c C-dshell-send-eofEnd of file character.
C-c C-ukill-shell-inputErase current line.
C-c C-wbackward-kill-wordErase the previous word.
C-c C-zstop-shell-subjobSuspend the current job.

7.2.13 Indentation Commands

C-x .set-fill-prefixPrepend 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-modeMajor mode: each tab defines a new indent for subsequent lines.
(none)text-modeExit indented text mode; return to text mode.
M-C-\indent-regionIndent a region to match first line in region.
M-mback-to-indentationMove cursor to first character on line.
M-C-osplit-lineSplit line at cursor; indent to column of cursor.
(none)fill-individual- paragraphsReformat indented paragraphs, keeping indentation.

7.2.14 Centering Commands

M-scenter-lineCenter line that cursor is on.
(none)center-paragraphCenter paragraph that cursor is on.
(none)center-regionCenter currently defined region.

7.2.15 Macro Commands

C-x (start-kbd-macroStart macro definition.
C-x )end-kbd-macroEnd macro definition.
C-x ecall-last-kbd-macroExecute last macro defined.
M-n C-x edigit-argument and call-last-kbd-macroExecute last macro defined, n times.
C-u C-x (start-kbd-macroExecute last macro defined, then add keystrokes.
(none)name-last-kbd-macroName last macro you created (before saving it).
(none)insert-last-keyboard-macroInsert the macro you named into a file.
(none)load-fileLoad macro files you've saved.
(none)macronameExecute a keyboard macro you've saved.
C-x qkbd-macro-queryInsert a query in a macro definition.
C-u C-x q(none)Insert a recursive edit in a macro definition.
M-C-cexit-recursive-editExit a recursive edit.

7.2.16 Basic Indentation Commands

M-C-\indent-regionIndent a region to match first line in region.
M-mback-to-indentationMove to first non-blank character on line.
M-^delete-indentationJoin this line to the previous one.

7.2.17 Detail Information Help Commands

C-h acommand-aproposWhat commands involve this concept?
(none)aproposWhat functions and variables involve this concept?
C-h cdescribe-key-brieflyWhat command does this keystroke sequence run?
C-h bdescribe-bindingsWhat are all the key bindings for this buffer?
C-h kdescribe-keyWhat command does this keystroke sequence run, and what does it do?
C-h lview-lossageWhat are the last 100 characters I typed?
C-h wwhere-isWhat is the key binding for this command?
C-h fdescribe-functionWhat does this function do?
C-h vdescribe-variableWhat does this variable mean, and what is its value?
C-h mdescribe-modeTell me about the mode the current buffer is in.
C-h sdescribe-syntaxWhat is the syntax table for this buffer?

7.2.18 Help Commands

C-h thelp-with-tutorialRun the emacs tutorial.
C-h iinfoStart the info documentation reader.
C-h nview-emacs-newsView news about updates to emacs.
C-h C-cdescribe-copyingView the emacs General Public License.
C-h C-ddescribe-distributionView information on ordering emacs from FSF.
C-h C-wdescribe-no-warrantyView 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