Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use vi Editing Software in linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use vi editing software in linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Vi is an editing software in linux, similar in nature to windows's notepad. Of course, a lot of Ubuntu is gedit, which is more intuitive, but vi is more troublesome to use, especially for beginners (I also have this experience), let me briefly talk about the use of vi:

1. Let me take the remote linux server as an example to explain: first of all, I use the putty tool to log in to the server.

2. Next, I'll take the / var/www/demo/www/phpinfo.php on our server as an example to introduce the simple use of vi. Enter: vi / var/www/demo/www/phpinfo.php enter in putty to enter vi to edit phpinfo.php

3. After entry, as shown in the figure:

4, if you want to add a line after the phpinfo.php; of this php file, we can first press the keyboard "a", and the cursor will jump to the previous green cursor, that is to say, "a" represents editing after the current cursor. So, after pressing "a" and typing an enter, a line is created, as shown in the figure:

5, and so on, you need to edit the document after where you can press "a" to edit it; if you want to edit the current cursor first, we can press the "I" key, in fact, "I" is the meaning of "insert" insertion, and then edit it. To sum up, both "a" and "I" can enter edit mode, but in a slightly different position.

6. In the process of editing, some children's shoes are accustomed to the habit of windows and want to use the keyboard key to move the cursor, which is no problem. The problem is that when you press "a" or "I", that is, when you open the editing mode, when you press the direction key or the keypad, the system will feel that you are entering information. This is the result of pressing "up and down" and "123" of the keypad in edit mode:

7. At this time, some children's shoes panicked. How should this be solved? This leads to the "ndd" command. First, press "esc" on the keyboard to exit edit mode, then use the arrow keys to move the cursor to the line that needs to be deleted, and then press the key "ndd", and the current line will be deleted.

8. If you are deleting a character, you can use the "delete" key, either in edit mode or out of edit mode.

9. How to save and exit if the editing is finished? Just exit edit mode and press ": wq" to enter.

Of course, there are other orders, such as:

W Save the file but do not quit vi:w file will also save the changes to file, do not exit vi:w! Force save, do not launch vi:wq save file and exit vi:wq! Force to save the file and exit viq: do not save the file, exit vi:q! Do not save the file, force to exit vi:e! Discard all changes and edit the file from the last time it was saved.

Note: to switch between vi edit mode and command line mode, press "esc" to enter command line mode; "a" or "I" to enter edit mode.

This is the end of the content of "how to use vi Editing Software in linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report