This page lists some frequently used emacs commands. C-x means press the CNTL and x keys simultaneously and M-x means press the Meta (or ESC) and x keys simultaneously.
| Emacs Control | |||
|---|---|---|---|
| invoke emacs | emacs FILE & or emacs -nw FILE |
quit emacs | C-x C-c |
| suspend emacs | C-z | resume emacs | fg or %emacs |
| quit current command | C-g | undo last command | C-x u or C-x _ |
| Cursor Movement | |||
| next char (forward) | C-f | previous char (back) | C-b |
| next word | M-f | previous word | M-b |
| beginning of line | C-a | end of line | C-e |
| next line | C-n | previous line | C-p |
| next page | C-v | previous page | M-v |
| first page | M-< | last page | M-> |
| Erasing Chars | |||
| delete right | C-d | delete left | DEL |
| Cut and Paste | |||
| cut line right (kill) | C-k | paste (yank) | C-y |
| Buffers & Files | |||
| read file into buffer | C-x C-f | kill buffer | C-x k |
| write buffer as new file | C-x C-w | save current buffer | C-x C-s |
| view list of buffers | C-x C-b | save all buffers | C-x s |
| split screen (horiz.) | C-x 2 | split screen (vert.) | C-x 3 |
| combine screens | C-x 1 | redraw screen | C-l |
| move to other buffer | C-x o | move to buffer | C-x b |
| Search/Replace | |||
| global-replace string | M-x replace-string | query-replace string | M-x query-replace |
| Compilation | |||
| compile | M-x compile | move to next error | C-x ` |
| Debugging | |||
| invoke gdb | M-x gdb | quit gdb | q |
| set breakpoint | C-x SPACEBAR | print value of expr | p Expression |
| run program | r | continue program | c |
| next statement | n | step into function | s |
| On-line Help | |||
| help about Subject | C-h a Subject | describe all bindings | C-h b |
| Command binding | C-h w Command | Key binding | C-h c Key |
| run emacs on-line info | C-h i | run emacs tutorial | C-h t |