vi Editor: Starting & Exiting To enter vi, just type `vi' followed by the name of the file to edit:
     vi filename

This will cause vi to read the file into its memory and allow you to edit it. If the file does not exist, vi will tell you so and then proceed to edit a new file which will be created when you exit the editor.

There are command options to vi that allow you to start up your editing session while placing the cursor at different locations of the file:

Start editing at the bottom of the file.
     vi + filename
Start editing at line 50.
     vi +50 filename
Start editing at first occurrence of the string "main".
     vi +/main filename
Recover edit session from last time system crashed.
     vi -r filename

To exit vi, use the one of the following two commands:

To exit and save the modifications you made:
To exit and ignore all the work you have done (keeping the original file):