| vi filename | begin vi |
| ZZ | save and exit vi |
| arrow keys | move in direction of arrow |
| backspace (or delete) | delete previous character |
| i | enter insert mode (start typing text) |
| ESC | leave insert mode (this puts you in command mode) |
| h, j, k, l | move left, down, up, and right respectively |
| w | move to start of next word in current line |
| b | move to start of previous word in current line |
| 0 (zero) | move to beginning of current line |
| $ | move to end of current line |
| 27G | move to line 27 |
| G | move to the last line in the file |
| CTRL-d | scroll down one screenful |
| CTRL-u | scroll up one screenful |
| CTRL-w | delete previous word |
| x | delete current character |
| dw | delete next word |
| db | delete previous word |
| dd | delete current line |
| u | undo last command |
| :w | save but do not exit |
| :q! | quit without saving |
| n | delete commands can be preceded by a number |
| for example 3dw deletes the next three words |
| ycmd | copy from current location to location given by cmd |
| for example y3w will copy three words | |
| yy | copy the current line |
| p | paste (after cursor) |
| /textCR | search forward for text |
| n | find next occurrence of text matching most recent search |
| ?textCR | search backward for text |
| . | matches any character |
| /< | matches beginning of word |
| \> | matches end of word |
| [str] | matches any character in str |
| for example, [ahx] matches a, h, or x | |
| [a-z] | matches any character in the range |
| for example, [a-c] matches a, b, or c | |
| * | matches zero or more occurances of the previous character |
| for example a* will match a, aa, aaa, etc. | |
| \ | is the escape character |
| for example, use \* to search for * |