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. )