VI Editor

There are many ways to edit files in Unix and for me one of the best ways is using screen-oriented text editor vi. This editor enable you to edit lines in context with other lines in the file.

Now a days you would find an improved version of vi editor which is called VIM. Here VIM stands for Vi IMproved.

The vi is generally considered the de facto standard in Unix editors because:

It's usually available on all the flavors of Unix system.

Its implementations are very similar across the board.

It requires very few resources.

It is more user friendly than any other editors like ed or ex.

You can use vi editor to edit an existing file or to create a new file from scratch. You can also use this editor to just read a text file.

Starting the vi Editor:
There are following way you can start using vi editor:

Command    Description
vi filename    Creates a new file if it already does not exist, otherwise opens existing file.
vi -R filename    Opens an existing file in read only mode.
view filename    Opens an existing file in read only mode.
Following is the example to create a new file testfile if it already does not exist in the current working directory:

$vi testfile