Basic commands for the VI editor of Linux

Source: Internet
Author: User
Tags save file

1, if you want to phpinfo.php in this PHP file, and then add a line, we can first press "a" on the keyboard, the cursor will jump to the previous green cursor, that is, "a" is represented after the current cursor editing . So, after pressing "a", after hitting a carriage return, a row is created

2, and so on, you need to edit after the location of the file can press "a" after the editing can be, if you want to edit the current cursor, we can press "I" key, actually "I" is "insert" inserted meaning , and then edit it. In summary, "a" and "I" can all go into edit mode, but the location is a little different.

3, in the process of editing, want to use keyboard keys to move the cursor, so there is no problem, there is a problem, when you press "a" or "I" after, that is, to open the editing mode, in the direction of the key or the keypad, the system will feel that you are entering information, which leads to the "NDD" command , first, press ESC to exit edit mode , then use the arrow keys to move the cursor to the row you want to delete, then press "NDD", and the current row will be deleted.

4, if you delete a character, then use the "delete" key, in the edit mode or exit edit mode can be deleted.

5, if the editor has completed the change how to save the exit? Just exit edit mode and press ": Wq" to enter.   : W saves the file but does not exit vi:w. File to save the modification to file without exiting vi:w! Force save, do not eject Vi:wq save file and exit vi:wq! Force save file and exit Viq: Do not save file, exit vi:q! Do not save the file, Force exit vi:e! Discard all changes and edit them from the last time you saved the file.

Note: VI edit mode and command line mode of the switch, press "ESC" into the command line mode, "a" or "I" into the editing mode.

Basic commands for the VI editor of Linux

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.