Vi is the default text editor. It comes with Linux OS. With VI editor we can edit an existing file or create a new file from scratch using the VI command. we can also use this editor to read an existing text file.

To create a file with VI editor, the following command is used,

vi filename

Ex. vi filename.txt

vi filename.txt command will open a new file called filename.txt to edit, or if filename.txt is already exited, it will open the existing file.

The first file opens in command mode. In VI editor I key is used to move files on Insert mode. If you wish to move on command mode ESC key is used.

To open the file in reading mode following command is used,

view filename

Ex. view filename.txt

Was this answer helpful? 3 Users Found This Useful (3 Votes)