Linux Learning Notes (14)--Command learning (basic use of VI)

Source: Internet
Author: User

Most of the Linux content in this blog is for reference: Bird's private cuisine

If you need, please refer to: http://vbird.dic.ksu.edu.tw/linux_basic/linux_basic.php

We already know most of the basic Linux content

1. View System Information

2. File and directory view

3. File creation

4. File Permission Properties

5. User creation and deletion

6. Package and unpacking of compressed package

Now you want to do the file editing and other operations to learn.

Linux, most of the configuration files are in ASCII Plain text form exists, so the use of simple text editing software can be modified settings!

1, we first try to enter the VI interface to see:

Enter the way: Enter VI directly at the command line (note: Now the new system is generally integrated vim,vim can be said to be an upgrade version of the old version vi)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/66/wKiom1Q8vgKDlYoQAAH5jHXXncs447.jpg "title=" 2.png " alt= "Wkiom1q8vgkdlyoqaah5jhxxncs447.jpg"/>

2, now we go to understand the next VI of the three modes:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/66/wKiom1Q8vRmwnqW0AATkoEn9K94242.jpg "title=" 1.png " Width= "622" height= "447" border= "0" hspace= "0" vspace= "0" style= "WIDTH:622PX;HEIGHT:447PX;" alt= " Wkiom1q8vrmwnqw0aatkoen9k94242.jpg "/>

By knowing the respective uses of three modes, let's start testing it now.

Now we're going to create a new document (. txt) in/tmp/blog/hznethome and add some content to it, save >> exit vim.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/68/wKioL1Q8wSjRttmuAAFMkVlnrPQ311.jpg "title=" 3.png " Width= "622" height= "129" border= "0" hspace= "0" vspace= "0" style= "WIDTH:622PX;HEIGHT:129PX;" alt= " Wkiol1q8wsjrttmuaafmkvlnrpq311.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4C/68/wKioL1Q8w4HydVQVAADzOeetH68550.jpg "style=" width : 622px;height:523px; "title=" 4.png "width=" 622 "height=" 523 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1q8w4hydvqvaadzoeeth68550.jpg "/>

As long as we run vim to edit the file name "" is to enter the general Vim mode, but in this mode, it is not possible to do any additional operations: such as adding content, moving the mouse, etc.

However, we use VIM to open the document is to change the contents of the content, but the above-mentioned mode can not be related to the operation, then we how to deal with it??

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/67/wKiom1Q8xQ6ib3DBAAOoBeowV7E841.jpg "title=" 6.png " Width= "662" height= "308" border= "0" hspace= "0" vspace= "0" style= "width:662px;height:308px;" alt= " Wkiom1q8xq6ib3dbaaoobeowv7e841.jpg "/>

From the above content can be known for editing mode, below we use I to try:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/67/wKiom1Q8xlSyfGnQAAE5wKORgW4072.jpg "title=" 5.png " Width= "622" height= "527" border= "0" hspace= "0" vspace= "0" style= "WIDTH:622PX;HEIGHT:527PX;" alt= " Wkiom1q8xlsyfgnqaae5wkorgw4072.jpg "/>

After the addition, we will save the content, we want to save the order to return to the "command line mode."

We are in edit mode and press ESC to return to command-column mode. Then use the following command directly to save the operation.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/6B/wKioL1Q85d6QtkyyAARuQX6HU3I731.jpg "title=" 7.png " Width= "622" height= "331" border= "0" hspace= "0" vspace= "0" style= "width:622px;height:331px;" alt= " Wkiol1q85d6qtkyyaaruqx6hu3i731.jpg "/>

In addition to the above command can save the contents of the exit, we can also use the: X command to implement the save exit operation.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4C/6B/wKiom1Q86GfgGUhIAAE2zE61Nok793.jpg "title=" 8.png " Width= "622" height= "351" border= "0" hspace= "0" vspace= "0" style= "width:622px;height:351px;" alt= " Wkiom1q86gfgguhiaae2ze61nok793.jpg "/>

3, by the above operation, we know how to enter the editing interface, how to save the exit, non-saving exit, mandatory, and so on, then we will be in the editing file in the detailed operation test:


Because the following operation is not good, so we can only be tested by ourselves:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4C/6B/wKiom1Q8696gw57pAAYB-qK3HJI426.jpg "style=" width : 622px;height:510px; "title=" 9.png "width=" 622 "height=" 510 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1q8696gw57paayb-qk3hji426.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/6C/wKioL1Q87BWxv532AARMpc9ti78077.jpg "title=" 10.png "Width=" 622 "height=" 313 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:622px;height:313px; "alt=" Wkiol1q87bwxv532aarmpc9ti78077.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4C/6B/wKiom1Q869_Rd7lMAAZyNU1ClRw606.jpg "style=" width : 622px;height:555px; "title=" 11.png "width=" 622 "height=" 555 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" wkiom1q869_ Rd7lmaazynu1clrw606.jpg "/>

4, know how to use Vim to edit the file. But sometimes when we're working on a document, we actually have to stop and we don't want to close the current vim interface and want to execute another command. So what are we going to do with it???

such as: I want to edit the Hz.txt file, after adding a portion of the content, I suddenly want to see the/tmp/blog/hznethome folder has those content.

You can use the following methods:

1. Jump from VIM to bash mode: in Vim's command-line mode: "Sh" "enter

2. Jump back from Bash to vim mode: In bash mode, press CTRL + D on the keyboard to enter

Such as:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4C/74/wKiom1Q91HzARa95AAGDdJhyxoA546.jpg "title=" 12.png "Width=" 622 "height=" 468 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:622px;height:468px; "alt=" Wkiom1q91hzara95aagddjhyxoa546.jpg "/>

Here, in Linux to edit the document is also over, we have to ...


This article is from the "Last Bus" blog, so be sure to keep this source http://hznethome.blog.51cto.com/722914/1564185

Linux Learning Notes (14)--Command learning (basic use of VI)

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.