Vi
i = insert crtl + c = exit insert mode ZZ or :x = save & exit
Going to any line
:50
In the command mode to get the same result:
50G
Typing just G in the command mode takes the cursor to the last line of the file and typing 1G takes the cursor to the beginning of the file.
Incrementing or decrementing a number
Ctrl-a Ctrl-x
Changing the case of letters
To toggle the case of the character below which the cursor is positioned, type ~ To change the case of the current line to upper case, type gUU To change the case of the current line to lower case, type guu To toggle the case of the current line, type g~~ To toggle the case of all characters from the cursor position to the end of the line, type g~$
Sorting within Vi
:sort
To sort lines and remove duplicate lines
:sort u