Opening a File in vi

vi is a command-line editor, for use in a terminal window. To open a file in vi, type:

vi testfile

testfile is the filename. In Figure 18-2, testfile doesn't exist, so a new file is opened.

Figure 18-2. vi text editor.

The tildes represent lines that don't exist in the file. As you insert text into the file, the tildes disappear. The filename is shown below the open file.

Most Linux distributions provide vim as the major text editor. vim is an advanced version of vi. In most cases, you should use vim. For many distributions, the vi command actually opens vim. If it doesn't, you can type:

 vim testfile ...

Get Spring Into Linux® 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.