linex vi editor commands
TRANSCRIPT
VI EDITOR COMMANDS
:q close file
vi create/open new file
/<word_tobe_searched>
:w save file
:wq save and quit from file
:q! quit from a read only file
:wq! save and quit from a read only file
:0 go to first line
:1 go to first line
G go to the last line
ctrl+g prints total number of lines and current line in %
:%s?<string_tobe_replaced>?<new_string>g global search and replace
k go to previous line
j go to next line
a go to next character and insert mode
i insert mode
escape come out of insert mode
o go to the next line and insert mode
B Page up
F Page down
h go to previous character
l go to next character
x delete character
dd delete single line
n dd delete n lines
m a mark current line with ‘a’
` a go to the line marked ‘a’
:’a,’by copy the lines marked between ‘a’ and ‘b’
:e <file> opens second file
yy, p copy & paste
dd, p cut & paste
n yy copy n lines
:r <file> inserts the file contents specified in to current file after current line (cursor)
r <c> replaces current character with ‘c’
ctrl + d half screen down
ctrl + u half screen up
^ go to start of line
$ go to end of line
w go to the next word
l go to the next character
e go to the end of current word
dw delete current word
cw replace current word
cc replace current line
. execute previous command
:sp <file> opens other file specified in the same screen, ctrl+ww can be used to shift between files
J join the next line to current line
Shift+5 matching begin end