The vi Editor

The vi ("visual") editor is a rather cryptic editor, in my humble opinion, but it can be found on virtually every installation of Linux so is good to know the bare essentials of this editor.

vi (filename)
Invokes the editor and loads the designated file.

One can use the arrow keys to position the cursor, but vi is not initially in a mode to accept changes. This is what makes the editor confusing to the new user.

To place the editor into insert mode, enter "i".

Now you can edit text by inserting new text and deleting or backspacing.

Leave edit mode by hitting escape.

To save, enter:

:wq

This can be interpreted as "write" then "quit".

To exit without saving:

Leave edit mode by hitting escape.

:q

If the file had been changed, vi will force you to confirm that you wish to discard your changes by requiring you to add an exclamation point:

:q!