Skip to content
Semillero
ARES

Linux

The vi editor

By Juan Felipe Martínez Bedoya

This is a very simple guide to the vi text editor. Before starting, note that vi has two main modes: command mode, where you run operations, and insert mode, where you type freely into the file.

Insert mode

  • Press i to enter insert mode.
  • In vi you cannot use the mouse to place the cursor; move around with the arrow keys.
  • Press Esc to go back to command mode.

Command mode

From command mode you save, quit, discard changes, and so on. These commands start with : and are confirmed with Enter.

Command Action
:w save the file
:q quit (vi will not let you if there are unsaved changes)
:q! quit without saving
:wq save and quit

Translated from Spanish.