Home > OS >  Linux vi simple usage
Linux vi simple usage

Time:09-26

Vi command
Start the vi editor
Vi [file name]
Edit the command
Command mode
: w/file name for the file filename
: wq save file
: q! Exit without saving
Dd to delete the current line
I: insert to the current cursor in front of the character,
I: is inserted into the line first,
A: insert behind the current cursor character,
A: is inserted into the end of each line,
O: under the current line on a new line, inserted into the beginning of a line with new,
O: in the current line on a new line above, inserted into the beginning of a line with new,

Move the cursor left h
L, move the cursor to the right
K upward move cursor
Move the cursor down j

: wq save out
ZZ save out
ZQ is not saved back
: q! Ignore all change forced out
: e! Discard all changes to open the original file

Set the nu or set number display line Numbers
Set nonu does not display the line number
Shell
BC calculated command
  • Related