VI Editor - some basic commands

The VI editor is the most preferred and powerful editor. Many new users avoid using this editor as it seems like taming the beast. Here are a few commands to help you ride the VI editor.

The VI editor works in two modes, command and modify mode. Unless you are in either of these modes, you may not be able to do anything in the editor

Start the VI editor

At the terminal window type 'vi <filename>'

Closing the VI editor

To close VI editor you will have to change the mode to command mode, to do this follow the following key sequence:

(ESC) :q (ENTER)

if you have edited a file and want to save the file and close the editor type:

(ESC) :wq (ENTER)

if you have edited a file and dont want to save the file but close the editor type:

(ESC) :q! (ENTER)

Entering the insert mode

to be able to insert text into your document, tyoe the command:

(ESC) i

Entering the delete mode

to be able to insert text into your document, tyoe the command:

(ESC) d