Go to the previous, next section.

How to use vi

To use vi, type the following command:

vi file

If the file you designate exists, it will be opened, and the contents will be displayed. If the file does not exit already, vi will open a file with the specified name. Vi has two modes: command and insert. When you start vi, you're in command mode. In command mode, vi accepts commands like the ones listed later in this section (commands to move, delete, save, etc.). In insert mode, vi accepts everything you type as text.

If you're in command mode, you can enter insert mode by typing a command like i, which inserts text starting at the cursor (there are others -- see the list of commands). If you're in insert mode, you can enter command mode by pressing the escape key.

Go to the previous, next section.