Centos vi editor commands

Source: Internet
Author: User

Vi editor's text description mode: Command mode, edit mode, and last line mode. Switch Mode: Command mode → I → edit mode, edit mode → Esc → command mode, command mode →: → last line mode. Function: Command Mode: controls the movement of the cursor, deletes characters, and copies paragraphs.
Insert Mode: adds and modifies text.
Last Line Mode: saves the file, leaves vi, and other settings.
Command mode command instructions
H. move the cursor to the left
L move the cursor to the right
J. move the cursor down a grid
K move the cursor up a grid
0: 0. move the cursor to the beginning of the row.
$ Move the cursor to the end of the row
H move the cursor to the top of the screen
M move the cursor to the center of the screen
L move the cursor to the bottom of the screen
Gg moves the cursor to the first line of the article
G move the cursor to the end of the article
W or W move the cursor to the next word
X Delete the character at the cursor
X Delete the character before the cursor
Dd deletes the row where the cursor is located.
* Dd deletes the row from the row where the cursor is located. * The row is a number.
D. Delete the cursor from the position to the end of the row.
R replaces a character at the cursor
R is replaced from the cursor and ended by Esc.
U cancels the operation in the previous step
U cancels all current operations
Yy copy the row where the cursor is located
P: place the copied content to the downlink of the row where the cursor is located.
Edit mode command instructions
A insert text behind the cursor
A inserts text behind the row where the cursor is located
I insert text before the cursor
I insert text in front of the row where the cursor is located
O Insert a new line (lowercase letter o) under the row where the cursor is located)
O Insert a new line (uppercase letter O) on the row where the cursor is located)
Last-line command description
E. Create a new file.
N load new files
W save the file
! Forcible operation
W! Forcibly save files
Q exit
Q! Force exit
Wq save and exit
Wq! Forcibly save and exit
Set nu display row number
Set nonu does not display row numbers
/*/Search, * any string
? Basically, the above operations are enough.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.