Useful Emacs Command Summary
| Menu | Keyboard shortcut | What it does |
| Simple edit commands: | ||
| File>Open | Ctrl-x Ctrl-f | Open an existing file or create a new file |
| File>Save | Ctrl-x Ctrl-s | Save the current file |
| File>Exit | Ctrl-x Ctrl-c | Quit Emacs |
| Edit>Undo | Ctrl-x u | Undo |
| Ctrl-s <string> | Search forward for <string> | |
| Ctrl-r <string> | Search backward for <string> | |
| Ctrl-g | Return to where search started (in search mode) | |
| Ctrl-x Ctrl-b | Show buffer list | |
| Ctrl-x k | Kill current buffer | |
| Ctrl-a | Move cursor to beginning of line | |
| Ctrl-e | Move cursor to end of line | |
| Ctrl-k | Kill (remove) current line | |
| Cut and paste commands: | ||
| Ctrl-space | Set the 'mark' at current cursor position | |
| Edit>Copy | Alt-w | Copy everything from the 'mark' until current cursor position. Alternatively, this section can be highlighted with your mouse. |
| Edit>Cut | Ctrl-w | Cut everything from the 'mark' until current curser position . |
| Edit>Paste | Ctrl-y | Paste the last section that was cut or copied. |
| Window Commands: | ||
Ctrl-x 2 |
Split window vertically | |
| Ctrl-x 1 | Close all windows except the one the cursor is in | |
| To start gdb debugger: | ||
| Tools>Debugger | Meta-x gdb | Start gdb in current window |
Useful gdb Debugger Commands
(short version of the command is in parenthesis)
| File <executable file name> | Load executable to debug |
| break (b) <line number / function name> | Place a breakpoint |
| run [<arguments>] | Run a program |
| print (p) <variable name> | Print variable value |
| step (s) | Step to the next line (step into functions) |
| next (n) | Go to the next line (step over functions) |
| continue (c) | Continue to next break point, or end of program |
| help (h) | Help |
| quit (q) | Quit |