Unix Basic Command in VI-Editor
1) Command Mode
--> This is the default mode in vi-editor--> when you invoke in vi by default you are in always in CMD mode.
--> Following some optional that can be used with CMD mode.
i) h --> moves one character left.
ii) l --> moves cursor one character right.
iii) j --> 1 line down.
iv) k --> 1 line up.
v) B --> moves back to beginning of the word.
vi) W --> moves forward to the beginning of the word.
vii) E --> move forward to the end of the word.
viii) X --> delete the character under cursor.
ix) dd --> delete current line
x) YY(yank) --> copy the current line.
xi) P --> To paste the copied line.
2) Input Mode
--> To enter the input mode you can press any of the below 10 characters from a given list.
i) A --> insert text the end of a line.
ii) I --> insert text at beginning of the line.
iii) a --> append the text after current character.
iv) i --> insert the text before the character.
v) O --> opens a new line before the current line.
vi) o --> opens a new line after the current line.
vi) r(char) --> replace single character under cursor.
vi) R --> replace multiple characters sometimes overwritten.
3) EX Mode
--> The 3rd mode of VI Editor is ex mode also know as LAST LINE mode.
--> To enter any command at ex mode type (:) colon sign
--> Following option are....
i) :wq --> saves the files and quits the editor.
ii) :x --> same as above (:wq).
iii) :w -->saves the contain of file & remain in editor.
iv) :q! --> it quits the vi editor without changing the files information.
v) :q --> it exists the editor of no change are mode to a file.
vi) s --> changes the current line.
vii) S --> replace the more than 1 character or single character under cursor.