In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how the linux system exits from vi. I hope you will learn a lot after reading this article. Let's discuss it together.
In Linux, the vim editor is the system's own text editor, but to modify a text file, it is not like Windows operation, but more novice, after entering the vi editor, can not exit to force shutdown, in fact, this vim (vi) is also very simple.
1. Enter the vim editor
Vim editor, you can create or modify files, the command is: vim / usr/local/con.cfg
If the file was not previously available, it is new, then there is a prompt below for the new file, and if the file already exists, there is no prompt.
After entering the editor, we first press "I" to switch to the "insert" state. You can edit the content by moving the cursor or spaces up and down, backspace and enter, which is the same as Windows.
2. The method and difference of exiting vim editor.
When the text editing is finished, it is usually necessary to exit the editor, and the exit editor can be divided into four cases: save exit, normal exit, unsaved exit and forced exit.
① save exit
When we edit or modify the contents of the file, of course we have to save and exit and then move on. At this point, we have to press the "ESC" in the upper left corner of the keyboard. Have you noticed? The insertion status in the lower left corner is gone, and then we enter the "colon", that is, ":" (without double quotes), and a colon appears below, waiting for the command to be entered, and enter "wq". The function is as follows:
W:write, writin
Q:quit, quit
Enter the car again and save and exit.
In fact, there are two ways to save and exit:
A: when you type the last command, type "x" directly, which is the same, that is, x=wq.
B: the quickest way: after pressing ESC, press shift+zz directly or switch to uppercase mode and press ZZ, you can save and exit, that is, press the uppercase Z twice.
We can view its contents with the view command cat: cat / usr/local/con.cfg.
② exits normally
A prerequisite for a normal exit is that the open text file has not been altered in content. Press ESC and then enter "colon". When entering the command, enter "Q" directly.
③ does not save exit
Very often, when you open the file or modify some places, you find that it is wrong and need not to save and exit. Press ESC first, then enter "colon". When entering the command, enter "Q!" directly.
④ forced exit
Less commonly used operations, first press ESC, and then press "colon", in the input command, directly enter "!", after exit, there will be a prompt!
Note: Linux commands should be lowercase!
After reading this article, I believe you have a certain understanding of how the linux system to exit vi, want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.