The use of the VI editor under the Linux system (for example, Ubuntu64 under VMware)

Source: Internet
Author: User

take some time to learn the VI editor in the morning and take some of the lessons learned in this blog post.

VI Editor is the basic compiler under the Linux system, working in character mode, is a very efficient text compiler, its function in the system and server management is not the normal graphics compiler can match, the following talk about how to use simple.


Preparation: After starting the virtual machine Ubuntu64, open the terminal with the shortcut ctrl+alt+t.


650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/94/D4/wKiom1kOwdijhidkAAF8dxyB3rs840.png-wh_500x0-wm_ 3-wmp_4-s_2254821281.png "title=" 01.png "alt=" Wkiom1kowdijhidkaaf8dxyb3rs840.png-wh_50 "/>



First, understand the VI editor three modes of use: (illustrate some conceptual issues)

1. General mode:

A document opened with VI is directly into the general mode. In general mode, you can move the cursor by manipulating the up and down buttons, you can use delete character or delete whole line, or you can use copy, glue to process the text.

2. Edit mode:

The function is to edit the contents of the document, which is missing in general mode. (It's reasonable to think about it, separating edits from other text operations, modifying and adding new content to the computer.) Enter in the way: by pressing "I, I, O, O, A, a, R, R" and so on after any one letter entered.

3. Command line mode:

In the general mode, enter the ":,/,?" button in three to move the cursor to the bottom. This is the time to switch to the command line mode. In this mode, you can provide a lot of actions, such as search data, read, save, a large number of substitution characters, leave VI, display line number, etc.


(vi the difference betweencreating and opening a file : If the entered document name exists, the document content is displayed, and if it does not, the blank document is displayed)


650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/94/D4/wKiom1kOyE6Ag1MrAAFNnXwa7mc284.png-wh_500x0-wm_ 3-wmp_4-s_1329570106.png "title=" 03.png "alt=" Wkiom1koye6ag1mraafnnxwa7mc284.png-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/94/D5/wKiom1kOySXxsy9gAACZW-tlKh4134.png-wh_500x0-wm_ 3-wmp_4-s_2590816967.png "title=" 04.png "alt=" Wkiom1koysxxsy9gaaczw-tlkh4134.png-wh_50 "/>


Second, the general mode of operation skills (mainly about some commonly used):

1. Cursor Movement:


650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/94/D5/wKiom1kOypfxrEq5AAJXUooM1kI924.png-wh_500x0-wm_ 3-wmp_4-s_1757599579.png "title=" 06.png "alt=" Wkiom1koypfxreq5aajxuoom1ki924.png-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/94/D9/wKiom1kO9tOi2YCmAANPbbbrDao097.png-wh_500x0-wm_ 3-wmp_4-s_1539701639.png "title=" 25.png "alt=" Wkiom1ko9toi2ycmaanpbbbrdao097.png-wh_50 "/>

2. Find and Replace:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/94/D4/wKioL1kOzbDguvF_AAROCBhkzgc596.png-wh_500x0-wm_ 3-wmp_4-s_2064675704.png "title=" 09.png "alt=" Wkiol1kozbdguvf_aarocbhkzgc596.png-wh_50 "/>

Here is a brief description of the diagram:

1). Query:


650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/94/D4/wKioL1kOzrvhhHI8AAHUQpvmJGY981.png-wh_500x0-wm_ 3-wmp_4-s_254767153.png "title=" 10.png "alt=" Wkiol1kozrvhhhi8aahuqpvmjgy981.png-wh_50 "/>
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/94/D4/wKioL1kO0ISxsRfqAAcA8C3-i7s632.png-wh_500x0-wm_ 3-wmp_4-s_2220800380.png "title=" 11.png "alt=" Wkiol1ko0isxsrfqaaca8c3-i7s632.png-wh_50 "/>


2). Replace:


650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/94/D5/wKioL1kO0bXj-mdhAAGbVWkrZFQ073.png-wh_500x0-wm_ 3-wmp_4-s_2854364811.png "title=" 12.png "alt=" Wkiol1ko0bxj-mdhaagbvwkrzfq073.png-wh_50 "/>

input: After the 66,71s/mandb_map/geekligreek/g command, replace the results of the query



3. Remove the copy sticky:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/94/D9/wKiom1kO9dWQY22NAATCBsYztDg828.png-wh_500x0-wm_ 3-wmp_4-s_4168035318.png "title=" 23.png "alt=" Wkiom1ko9dwqy22naatcbsyztdg828.png-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/94/D9/wKiom1kO9ividZPHAAL4PN-jU60963.png-wh_500x0-wm_ 3-wmp_4-s_21299146.png "title=" 24.png "alt=" Wkiom1ko9ividzphaal4pn-ju60963.png-wh_50 "/>


Three, the editing mode of operation Skills:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/94/D9/wKiom1kO9HGT9xszAAKUCt8Sim0467.png-wh_500x0-wm_ 3-wmp_4-s_1277860755.png "title=" 19.png "alt=" Wkiom1ko9hgt9xszaakuct8sim0467.png-wh_50 "/>


650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/94/D8/wKioL1kO9FuDTBh-AAQ9_bxieZ8478.png-wh_500x0-wm_ 3-wmp_4-s_4291455439.png "title=" 20.png "alt=" Wkiol1ko9fudtbh-aaq9_bxiez8478.png-wh_50 "/>

1. Enter insert mode:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/94/D6/wKiom1kO2ZnRRmfuAAGpevMGi2A072.png-wh_500x0-wm_ 3-wmp_4-s_3687084765.png "title=" 15.png "alt=" Wkiom1ko2znrrmfuaagpevmgi2a072.png-wh_50 "/>

input I (no hint under Ubuntu system VI), operation in normal mode is not available in insert mode

(I is: inserted from the current cursor location)

(Hint: You cannot scroll the mouse wheel in edit mode, it will also be entered as a letter)

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/94/D6/wKiom1kO2tWSCLt-AAGPuxhVEQk718.png-wh_500x0-wm_ 3-wmp_4-s_1015502134.png "title=" 16.png "alt=" Wkiom1ko2twsclt-aagpuxhveqk718.png-wh_50 "/>



2. Enter the replacement mode:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/94/D6/wKioL1kO3WOSMBBKAAG9MxndFvM279.png-wh_500x0-wm_ 3-wmp_4-s_1546321335.png "title=" 17.png "alt=" Wkiol1ko3wosmbbkaag9mxndfvm279.png-wh_50 "/>


Four, command-line mode of operation Skills:


650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/94/D9/wKiom1kO-BHSoCdyAAYsjTe46G4934.png-wh_500x0-wm_ 3-wmp_4-s_3130470164.png "title=" 26.png "alt=" Wkiom1ko-bhsocdyaaysjte46g4934.png-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/94/D8/wKioL1kO-JXzX3UWAAX8KDGFZRA340.png-wh_500x0-wm_ 3-wmp_4-s_2849961364.png "title=" 27.png "alt=" Wkiol1ko-jxzx3uwaax8kdgfzra340.png-wh_50 "/>



Well, that's it, but the readers still have to go to practice practiced hand, all the idea of flying in the sky must have the realization of land products!




This article is from the "12392717" blog, please be sure to keep this source http://12402717.blog.51cto.com/12392717/1922890

The use of the VI editor under the Linux system (for example, Ubuntu64 under VMware)

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.