In the VI editing mode in Linux, you can directly modify the file ~

Source: Internet
Author: User

Before reading this article, if you do not know about VI, please first read the article below.

VI. Command Input ex escape

Http://blog.csdn.net/sxzlc/article/details/7407742

Bytes -----------------------------------------------------------------------------------

When you use Putty to directly connect to Linux.

 

We can use VI to directly modify the file.

 

Below are some common commands ~

----------------------------------------------

1. Enter edit mode

(At the time of entry, it is actually in the command mode)

After ESS test.txt, press VI continuously to enter the VI editing mode.

========================================================== ====================

2. Save and exit

(The following command is in the ex escape mode)

Enter WQ in the command line to save and exit.

 

3. Discard the modification and exit directly.

: Q! You can exit and discard the modification.

 

(The following command is in the command mode)

4. query in VI Mode

/Sxz/session/timeout

In this way, the cursor will only stay on the first letter. For example, it will only stay on the S of the session.

 

However, there is a benefit: by N, You can query the next, n can find the previous.

In short, this query method is more convenient.

 

Note: The above 2 and 3 commands are all input in the command line. In editing mode,

Press ctrl C twice in a row to enter the command line. Enter the preceding command: Q! : WQ

(Pressing ctrl c twice in a row is actually from the input method to the command method and then to the ex escape method)

========================================================== ========================

5. You can also perform a query without entering the VI Mode.

However, we can query it when we exit VI Mode.

The query method is

Enter the command/sxz/timeout in the command line.

Here, sxz timeout is the string you want to query.

 

(Note: This method will mark all the strings you want to query, but you cannot query the next one. )

 

 

 

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.