Linux input and output and vim command summary

Source: Internet
Author: User

I. Management input and OUTPUT

in a Linux system, the correct output number is 1, the error output number is 2

performed in the system with a normal user "Student"

find/etc/-name passwd > file

Because student does not have the right to view more passwords, it is only possible to show files in the shell that have been found but have no rights to view them.


650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/08/27/wKiom1nc9dOgXYhxAAFtkj_HoB0211.png-wh_500x0-wm_ 3-wmp_4-s_3181695122.png "style=" Float:none; "title=" screenshot from 2017-10-08 14-45-59.png "alt=" Wkiom1nc9dogxyhxaaftkj_hob0211.png-wh_50 "/>

And in student identity with can see the file exists in File1.

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/A6/D9/wKioL1nchsXCRUbfAAHFLRgBwFU409.png-wh_500x0-wm_ 3-wmp_4-s_4260384344.png "style=" Float:none; "title=" screenshot from 2017-10-08 14-53-08.png "alt=" Wkiol1nchsxcrubfaahflrgbwfu409.png-wh_50 "/>

1 is correct (can be ignored and not written), 2 means error,& means all

It must be noted that ' > ', ' 2> ', ' &> ' will overwrite the source file content

find/etc-name passwd > File # #重定向正确输出

find/etc-name passwd 2> file # #重定向错误输出

find/etc-name passwd &> file # #重定向所有输出

is to execute find/etc/-name passwd 2> file1 and put the wrong result (without permission) in File1.

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/08/27/wKiom1nc9dTyuPxIAAHQ9HcKCeA988.png-wh_500x0-wm_ 3-wmp_4-s_3380958762.png "style=" Float:none; "title=" screenshot from 2017-10-08 15-00-38.png "alt=" Wkiom1nc9dtyupxiaahq9hckcea988.png-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A6/D9/wKioL1nchsaz2mZEAAHhZcv2CR4230.png-wh_500x0-wm_ 3-wmp_4-s_1326156295.png "style=" Float:none; "title=" screenshot from 2017-10-08 15-02-35.png "alt=" Wkiol1nchsaz2mzeaahhzcv2cr4230.png-wh_50 "/>

Note: 2>,&> will overwrite the source file content ">file1 that is to empty file1"

' >> ' 2>> ' &>> ' will not overwrite the content of the source file, it will characters the corresponding output word to the end of the file.

find/etc-name passwd >> file # #追加正确输出

find/etc-name passwd 2>> file # #追加错误输出

find/etc-name passwd &>> file # #追加所有输出


This allows you to append the contents to the ' file '


2. ' | ' The role of the pipe character pipeline is to change the output of the previous command into the input of the post-pipeline command

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/A6/D9/wKioL1nchsfh94ylAAAad3buT0w732.png-wh_500x0-wm_ 3-wmp_4-s_583336607.png "style=" Float:none; "title=" screenshot from 2017-10-08 16-43-14.png "alt=" Wkiol1nchsfh94ylaaaad3but0w732.png-wh_50 "/>

The wrong output in the system is not available through the pipeline.

use ' 2>&1 ' to change the wrong output number from 2 to 1 (you can try it yourself according to ' find/etc/-name passwd 2>&1 file ')

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/08/27/wKiom1nc9dWRSMKtAAAjD6VrU2c981.png-wh_500x0-wm_ 3-wmp_4-s_4240261433.png "style=" Float:none; "title=" screenshot from 2017-10-08 17-10-43.png "alt=" Wkiom1nc9dwrsmktaaajd6vru2c981.png-wh_50 "/>

Two Vim compiled files

    1. Cat compiled files: The cat command is supposed to look at the file, but can enter the compilation mode with special symbols

      Cat >> filename << xx

      >xx (with two identical characters as the start and end of the compilation of a file)

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/A6/D9/wKioL1nchsejA8KTAABbFcYcjMk053.png-wh_500x0-wm_ 3-wmp_4-s_1307122678.png "style=" Float:none; "title=" screenshot from 2017-10-08 17-21-29.png "alt=" Wkiol1nchseja8ktaabbfcycjmk053.png-wh_50 "/>

character Management in 3.vim command mode


yl # #复制一个字母

y3l # #复制3个字母

yw # #复制一个单词

y3w # #复制3个单词

yy # #复制一行

y3y # #复制3行

P # #复制完成后按 "P" Paste

2. Deletion of characters

DL # #删除一个字母

d3l # #删除3个字母

DW # #删除一个单词

d3w # #删除3个单词

DD # #删除一行

D3D # #删除3行

3. Cutting of characters

CL # #剪切一个字母

c3l # #剪切3个字母

CW # #剪切一个单词

c3w # #剪切3个单词

cc # #剪切一行

c3c # #剪切3行


ESC---> P # #剪切过后会进入到插入模式, be sure to exit Insert mode when performing paste actions

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/08/27/wKiom1nc9dbCGWTtAAB18k-ILvs835.png-wh_500x0-wm_ 3-wmp_4-s_1801105786.png "style=" Float:none; "title=" screenshot from 2017-10-08 21-48-23.png "alt=" Wkiom1nc9dbcgwttaab18k-ilvs835.png-wh_50 "/>

Vim can be configured to work in Vim's command mode

: Set Nu # #行号添加

: Set Nonu # #取消行号

: Set Mouse=a # #添加鼠标选择

: Set Cursorline # #行线显示

The above settings are temporary,

Permanent setting mode

VIM/ETC/VIMRC # # #此文件为vim的配置文件, add the above parameter at the end of this file, add to the file to take effect.

Keyword search in 2.vim command mode # # # # #

/keywords

N Match down

N Up match

3.vim Cursor Movement #####

in command mode

: Digital # #移动到指定的行

G # #文件最后一行

GG # #文件第一行

4,. In insert mode

I # #光标所在位置插入

I # #光标所在行行首

a # #光标所在字符的下一个位置

A # #光标所在行行尾

o # #光标所在行下一行

O # #光标所在行上一行

s # #删除光标所在字符插入

S # #删除光标所在行插入


650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/A6/D9/wKioL1nchsjARvzEAABcRQ4r6FE748.png-wh_500x0-wm_ 3-wmp_4-s_2984634118.png "style=" Float:none; "title=" screenshot from 2017-10-08 22-08-57.png "alt=" Wkiol1nchsjarvzeaabcrq4r6fe748.png-wh_50 "/>

Exit mode of 5.vim

: Q you can exit directly when you open a file with Vim without any action on the character

: q! when using vim to open a file and manipulate the characters, discard all operations to exit

: Wq Save Exit

: wq! Force -Save exit, take effect for Superuser and file owner

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/08/27/wKiom1nc9dbzE9QjAABwdKpwPaE936.png-wh_500x0-wm_ 3-wmp_4-s_15450117.png "style=" Float:none; "title=" screenshot from 2017-10-08 22-23-06.png "alt=" Wkiom1nc9dbze9qjaabwdkpwpae936.png-wh_50 "/>

Vim's Visual Model # # # # #

Press "Ctrl + V" in command mode to enter the visual mode

In visual mode, you can select characters in the area

Bulk add characters in visual mode

*>> Ctrl + V Select the column to which you want to add characters

*>> Press "I" into insert mode, write the characters to be added

*>> Press ESC

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/08/27/wKiom1nc9deSI3MfAABXAwijilU378.png-wh_500x0-wm_ 3-wmp_4-s_2643686199.png "style=" Float:none; "title=" screenshot from 2017-10-08 22-33-52.png "alt=" Wkiom1nc9desi3mfaabxawijilu378.png-wh_50 "/>





This article is from the "13345576" blog, please be sure to keep this source http://13355576.blog.51cto.com/13345576/1971248

Linux input and output and vim command summary

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.