Tutorial #1 vi
1. Log on to UNIX if necessary.
2. Enter vi to create a file named phone.list . Use either the insert
or append command ( i or a ), and type the following lines (be sure
to press return at the end of each line):
Ruth Tenon 718 555-1111
Judy Rodriguez 360 555-0807
Damon Rochester 505 555-7777
Steve McKinney 206 555-8989
3. Start another line with your first and last name. Backspace
over the last name and spell it differently. Then enter command
mode.
4. Move the cursor (using h, j, k, l ) within the lines. Try the arrow
keys as well to see if they work or not. Then position the cursor
and add your telephone number.
5. Enter command mode, and then save the file by typing ZZ; be
sure to use uppercase letters here. Notice the shell prompt.
Return to vi to edit the same file.
6. Change the name of Damon to Michael .
7. Abandon the file by returning to command mode, and then
typing :q!
8. Enter the file with vi again. Notice that the change did not take
place.
9. Change the spelling of Judy to Judi . (Delete y, then insert i
at that location)
10. Add five more lines to the file; create any data in the same
format.
11. Save the file, including the changes. Display it from UNIX
using the cat command.
12. If you like, create another file and practice with insert mode
and the commands you already know how to use.
If it doesn't work:
A. Pressing ESC should put you in command mode any time you
aren't in it. Use the keyboard keys for cursor movement. Use x to
delete the character at the cursor, a to insert characters following
the character at the cursor and i to insert characters preceding the
character at the cursor.
B. If your screen looks unacceptably messy, press ^L or ^R to
redraw the current contents.
C. To add data at the end of the file, move the cursor to the last
character you have (previously) typed, and then press: a .
Questions? Robert Katz:
rkatz@ned.highline.edu
Last Update June 26, 2002