Sections

Just Enough to Get By

As the heading suggests, in this section I attempt to present a subset of the vi commands large enough to enable you to accomplish basic tasks, but small enough that a beginner can remember most of them. Note that the topics covered in this section are covered in more detail in other sections.

Opening and Closing

You open a file by typing “vi <filename>” on the command line— for example:

vi chapter29.txt

You close a file by getting into command mode (use the <Esc> key), typing a colon “:” and then typing wq (write quit). If you don't want to save changes to the file, type q (quit). If it gives you any trouble, type wq! (enthusiastic quit).

Inserting Text

You insert new text by getting into edit mode. There are ...

Get Linux® Desk Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.