Starting with vi
Last updated
Last updated
Most often, you start vi
to open a particular file. For example, to open a file called /tmp/test
, enter the following command:
If this is a new file, you should see something similar to the following:
A blinking box at the top represents where your cursor is located. The bottom line keeps you informed about what is going on with your editing (here, you just opened a new file). In between, there are funny looking characters known as tildes (~
) - they act as filler because there is no text in the file yet.
Now here’s the intimidating part...
To make things worse, you can’t just start typing. If you do, the computer is likely to beep at you (and some people complain that Linux isn’t friendly...). To understand what is happening here, you first need to know the two main operating contexts: command mode and input mode.
The vi
editor always starts in command mode.
Before you can add or change text in the file, you have to type a command (one or two letters, sometimes preceded by an optional number) to tell vi
what you want to do.
Case is important, so use uppercase and lowercase exactly as shown in the examples...