Datasheet
24
Phase 1
Working on the Command Line
Setup
In principle, you could use an emergency boot disk, but you’ll probably find it more convenient
to use your regular Linux installation. Log into your computer as an ordinary user. You should
then copy the /etc/lilo.conf file to a safe temporary location, such as your home directory:
$ cp /etc/lilo.conf ~/
If your system lacks a lilo.conf file, locate one on the Web or enter the one presented
shortly in a GUI text editor and save it in your home directory.
Caveats
Do not try to perform this task as root and do not attempt to directly edit /etc/lilo.conf.
Doing so is likely to damage your system. Of course, in a real emergency recovery situation,
you’d need to perform these tasks as root, but for practice purposes, learning Vi as an ordi-
nary user is safer.
Procedure
Vi is a bit strange, particularly if you’re used to GUI text editors. To use Vi, you should first
understand the three modes in which it operates. Once you understand those modes, you can
begin learning about the text-editing procedures Vi implements. You must also know how to
save files and exit from Vi.
Most Linux distributions actually ship with a variant of Vi known as Vim, or Vi
Improved. As the name implies, Vim supports more features than the original
Vi does. The information presented here applies to both Vi and Vim. Most dis-
tributions that ship with Vim enable you to launch it by typing vi, as if it were
the original Vi.
Vi Modes
At any given moment, Vi is running in one of three modes:
Command mode This mode accepts commands, which are usually entered as single letters.
For instance, i and a both enter insert mode, although in somewhat different ways, as
described shortly, and o opens a line below the current one.
Ex mode To manipulate files (including saving your current file and running outside pro-
grams), you use ex mode. You enter ex mode from command mode by typing a colon (:), typ-
ically directly followed by the name of the ex mode command you want to use. After you run
the ex mode command, Vi returns automatically to command mode.
Insert mode You enter text in insert mode. Most keystrokes result in text appearing on the
screen. One important exception is the Esc key, which exits from insert mode back to com-
mand mode.
83484.book Page 24 Monday, September 18, 2006 8:58 AM










