Starting an Edit Session

The vi editor is invoked by the vi command:

$ vi filename
				

The editor functions in one of three modes: command mode, insert mode, and last-line mode (sometimes called single-line mode, or ex mode). When the edit session starts, vi enters command mode. Several commands can change the mode to insert mode (I, i , a , A, o, O, and so on), and one command can change the mode to last-line (:).

If the file to be edited does not exist, vi reports that it is a new file and enters the command mode of operation. The following example show the startup of a vi session involving a new file:

$ vi junk

~
~
~
~
(...)
"junk" [New File]

If the file exists, vi displays a screen full of data from the file—or the whole file if it is less ...

Get Korn Shell Programming by Example 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.