Edit Anything with Just 10 vi Commands

There are more than 75 separate letter and punctuation commands to learn in vi. Where should you start? This section covers the first 10 vi commands to learn, and they will enable you to edit anything. If you are new to vi, follow the preceding procedure to create a cal-junk practice file so that you don’t accidentally change an important file.

Moving Around Using the h, j, k, and l Commands

In vi, you can move the cursor by entering the commands listed in Table 20.1. Some people think that the letter l should move left, so this command also has been added.

Table 20.1. Moving Around Using the h, j, k, and l Commands
vi CommandDescriptionMnemonicAlternative
hMove leftLeftmost charLeft arrow key
jMove down

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.