vi filename
:w
or :wq
:q!
/text
, press Enter to jump to the first matching text, use n
and N
to jump to the next or previous match:s/old/new/g
, where old
is the text to be replaced, new
is the new text, g
means global replacementyy
to copy the current line, enter y
+n
+y
to copy n lines, then move the cursor to the location to be pasted, enter p
to pasteu
:q
, if there are modifications, it will prompt to save, otherwise it will quit directly