Читать книгу Linux Bible - Christopher Negus - Страница 144

Starting with vi

Оглавление

Most often, you start vi to open a particular file. For example, to open a file called /tmp/test, enter the following command:

 $ vi /tmp/test

If this is a new file, you should see something similar to the following:

 □ ~ ~ ~ ~ ~ "/tmp/test" [New File]

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 tildes (~) as filler because there is no text in the file yet. Now here's the intimidating part: There are no hints, menus, or icons to tell you what to do. To make it 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.)

First, you need to know the two main operating modes: command and input. 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!

Linux Bible

Подняться наверх