Command functions in Vi text editing

Source: Internet
Author: User

Vi is a commonly used text editing method in Linux, just like using txt in Windows.

Of course, you can use the mouse in Windows, but in the Linux server System (the server does not select the interface), we have to use commands to provide us with a quick start. The following is an introduction:

Vi haha creates a file named haha in the current directory, just like inputting notepad in windows running. It needs to be saved before it can be created.

After entering the text, I is in the command line status and cannot edit the text. Press the I key to edit the text.

After wq is edited, save and exit. Press esc to enter the command line status. Press: To enter wq.

Q: If you do not perform any operations on the text, you can exit the command line.

Q! If you do not want to save the edited text, you can: q! In the command line status! Force exit

/Port in the command line state, enter/port to quickly search for the port keyword location in the text. If there are multiple related keywords in the text

: 50 enter: 50 in the command line status to directly jump to the 50th lines of text. This is also a frequently used command.

: If set nu is input in the command line status, the text will display the row number, and you will know it if you try.

Dd in the command line state, you can delete the current line by pressing dd in the row where the cursor is located.

In the command line status, you can press dG to delete all content in the text.

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.