VI Editor

To create or to open a file for editing

[root@comp1 ~]# vi

[root@comp1 ~]# vi fullreport

To go to insert mode
i – inserts the text at current cursor position
r – replace a single char at current cursor position

Commands at Execute Mode
:q – quit without saving
:q! – quit forcefully without saving
:w – save
:wq – save & quit
:wq! – save & quit forcefully
:se nu – Setting line numbers
:se nonu – Removing line numbers
:84 – Press enter goes to line 84

Commands at Command Mode
dd – Deletes a line
2dd – Deletes 2 lines
yy – Copy a line
2yy – Copies 2 lines
p – put (deleted or copied text)
u – Undo (can undo 1000 times)
Ctrl+r – Redo
G – Moves cursor to last line of file
/ – To search for a particular word

Leave a comment