Datasheet

26
Phase 1
Working on the Command Line
FIGURE 1.2 The last line of a Vi display is a status line that shows messages from
the program.
Adding a new entry to lilo.conf involves duplicating the lines beginning with the image=
line and modifying the duplicates. Therefore, the first editing task is to duplicate these four
lines. To do this, follow these steps:
1. Move the cursor to the beginning of the image= line by using the down arrow key; you
should see the cursor resting on the i.
The h, j, k, and l keys can also be used in place of the left, down, up, and right
arrow keys. This is a holdover from the days before all keyboards had arrow keys.
2. You must now “yank” four lines of text. This term is used much as “copy” is used in most
text editors—you copy the text to a buffer from which you can later paste it back into the
file. To yank text, you use the yy command, preceded by the number of lines you want to
yank. Thus, type 4yy (do not press the Enter key, though). Vi responds with the message
4 lines yanked on its bottom status line. The dd command works much like yy, but it
deletes the lines as well as copying them to a buffer. Both yy and dd are special cases of
the y and d commands, respectively, which yank or delete text in amounts specified by the
next character, as in dw to delete the next word.
3. Move the cursor to the last line of the file by using the arrow keys.
4. Type p (again, without pressing the Enter key). Vi pastes the contents of the buffer starting
on the line after the cursor. The file should now have two identical image= stanzas. The
cursor should be resting at the start of the second one. If you want to paste the text into
the document starting on the line before the cursor, use an uppercase P command.
83484.book Page 26 Monday, September 18, 2006 8:58 AM