The use of the VI Editor for basic Linux knowledge

Source: Internet
Author: User
Tags aliases

Before introducing the VI editor, let's take a look at the use of aliases in the Linux system (article knowledge written from Bo Master worm, thanks to bloggers)

Aliases are different two names refer to a person, different two commands have the same effect. Now, you must be wondering what aliases are in your system. [Email protected] ~]# aliasIn the query system aliases alias cp= ' Cp-i ' Alias l.= ' ls-d. *--color=tty ' Alias ll= ' Ls-l--color=tty ' Alias ls= ' ls--color=tty ' Alias mv= ' MV- I ' Alias rm= ' rm-i ' Alias vi= ' vim ' Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde ' How to define aliases, if I used to copy in DOS and do not want to use CP, then you can define a copy alias for the CP. [Email protected] ~]#alias COPY=CPAssign the CP command function to copy[[email protected] ~]#alias drm= "RM-RF"Define a DRM alias for the "RM-RF" command. [Email protected] ~]#unalias CopyCancel Alias vim/vi Editor Vim/vi is a powerful screen text editor, the most commonly used text editor on Linux and UNIX, and it is the function of creating, editing and displaying text files. Vim/vi no menus, only commands. Vim is a reinforced version of VI, when a lot of users are still accustomed to using VI to edit files [[email protected] test]# vim services.test into the file three modes of VI:

three modes of conversion: Command modeEnter a, I, O into the Insert Mode Insert ModePress ESC to enter Command mode Command modeEnter: (colon) Enter edit Mode edit ModeThe next instruction Error returns Command modeDo not feel a bit around, in fact, we just remember, vi into the file, press I key can be edited on the file. When the edits are complete, press the ESC key to exit edit mode. The exit must be remembered in three.    : Q is exit (when file is not changed): q! Do not save exit (when the file changes): Wq Save and exit Vim/vi: Shift+zz Press two times shift+z key to exit the save. Learn about some of the commands below to help us quickly edit and use VI   Command mode:The command mode mainly uses the direction key to move the cursor position to edit the text, the following lists the commonly used operation commands and the meaning of the upper, lower, left, right keyboard and H, J, K, l keys are moving the cursor respectively. $------------Move to end of line 0 (0)-----Move to the beginning of the start of H----------move to the top of the screen m----------move to the center of the screen L----------move to the bottom of the screen GG---------to the first line of the file G----- -----to the end of the file Pagedn---Move down one page pageup---Move up one page d+ arrow----delete the text DD----Delete the whole line pp------------- column, and enter the input mode Insert mode:  You can enter "Insert mode" from "Command mode" by the following command A------------append text a------------at the end of the line append text i-------------insert text I before the cursor-------------Insert the text at the beginning of the bank o------------insert a new line under the cursor o----------- Insert a new line on the cursor ESC--------Exit "Insert Mode" edit mode:
Editing mode mainly for some text editing aids, such as String search, substitution, saving files and other operations.
: Q---end VI program, if the file has been modified, save the file first: q! ---Forced Exit VI Program: WQ------Save the changes and exit the program: Set Nu----to make the line number before each line of text: Set Nonu------The line number before each line: N------------to Nth row

The use of the VI Editor for basic Linux knowledge

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.