How to use Vi: a minimalist guide

Occasionally you may find Vi is the only editor available. To use it to edit somefile.txt type:

vi somefile.txt

Now type:

i

This puts you into insert mode and you can type. Type something.

When you are done, type the Esc key to go back to command mode. Type:

ZZ

(must be upper case) to save the file and quit.

If you don’t want to save, type:

:q!

to quit without saving.

At this point I am tempted to add all sorts of other tips, like / to search, but then this would not be a minimalist guide!