shell+vim--05

Source: Internet
Author: User

ln--->link links, there are two types of links:

Soft Connect ln-s source file: Equivalent to create a shortcut, the source file is damaged after the link is invalid
Ln-s a.text a.text.soft//Create a soft link named A.text.soft for A.text
Hard Connect ln source file destination file
ln a.text a.text.hard//Create a hard link named A.text.soft for A.text

#硬连接相当于cp-P + sync with new,-P is the property of the original file

Redirect and pipe character

Function: Outputs the execution result of the command to the specified file, rather than directly on the screen

0 Standard input keypad stdin Read Only
1 standard output terminal stdout write only
2 standard error terminal stderr write only

Other files read/write

Build a process structure with numbered channels (file descriptors) in Linux to manage open files
Operation of file data by connecting to a file through a process

Type 1: Redirect standard input, output command execution results to the specified file home

    • 1> (can also omit write as >) represents overwrite Write
    • 1>> (can also omit write as >>) represents append Write

Type 2: Redirect standard error, writes error information to the specified file

    • 2> represents overwrite Write
    • 2>> represents append Write

Type 3: REDIRECT standard input and standard error, write standard output and standard error output to the specified file

    • &> representative Overwrite Write
    • &>> representative Append Write

Example:
    • I use root login, come to a folder, any folder can execute the command ll > Message.txt you will find that the results of the execution are in the message.
    • Execute ls > message.txt you will find that the result of execution is still in Message.txt, but the original content is overwritten.
    • Execute Find/-user student (I have a student user in advance) there will be a bunch of execution results, with error output and normal output
    • Perform Find/-user studnet > Message.txt You will find that the standard error output is printed on the screen and the normal output is written to the Message.txt file
    • Perform Find/-user studnet 2> message.txt You will find that the standard output is printed on the screen and the standard error output is written in the Message.txt file
    • Execute Find/-user studnet &> Message.txt You'll find all the output is written in the file

Vim Text Editor
Vi/vim Vim is an upgraded version of VI
VIM Features: High scalability, support for multiple language scripts, support for file types of plug-ins, support the text of various kinds of Sao QI operation

Enter Vim or VI directly in the terminal to see some of the current vim information

Vim filename can use Vim to do some dirty work on this file, after opening there are three modes:

Command mode: This mode is used for file navigation, copy and paste, cut, can use simple commands, undo, restore
Input mode: Normal text editing mode, regular operation of text, can also replace text
Last-line mode: Save, exit, search, replace

Use VIM to open the default mode of the file is the command mode, this time you are unable to manipulate the file, press O will give you a line switch to input mode, press I key will directly to you switch to input mode, press the ESC key back to command mode, and then enter: You can go to the last line mode in the last line mode or command input: You can save the changes to the file, also in the two modes of input: W can save the file,: Q, you can exit, but if you change the file is not saved: Q cannot quit, this time you need to force exit: q!

Cannot switch between the last line mode and the input mode, only through the command mode to relay

shell+vim--05

Related Article

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.