Press Esc to switch from insert mode to command mode. In command mode, move the
cursor with H , J , K , and L . The keys have the following functions:
H
Move one character to the left
J
Move one line down
K
Move one line up
L
Move one character to the right
The commands in command mode allow diverse variations. To execute a command
several times, simply enter the number of repetitions before entering the actual command.
For example, enter 5 L to move the cursor five characters to the right.
A selection of important commands is shown in Table 18.2, "Simple Commands of the
vi Editor" (page 378) This list is far from complete. More complete lists are available
in the documentation found in Section 18.4.3, "For More Information" (page 379)
Table 18.2
Esc
I
A
Shift + A
Shift + R
R
378
Installation and Administration
Simple Commands of the vi Editor
Change to command mode
Change to insert mode (characters appear at the current cursor
position)
Change to insert mode (characters are inserted after the current
cursor position)
Change to insert mode (characters are added at the end of the
line)
Change to replace mode (overwrite the old text)
Replace the character under the cursor