Management input and output of operation and maintenance learning and vim editing mode

Source: Internet
Author: User

Unit 4

1. Managing input and output

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

Perform "student" with ordinary users in the system

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9C/46/wKioL1luKKiyUThWAARyhVZi4yQ816.png-wh_500x0-wm_ 3-wmp_4-s_629726353.png "title=" [O4ug (jm5vnz{2)]1qqgg4d.png "alt=" Wkiol1lukkiyuthwaaryhvzi4yq816.png-wh_50 "/>

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

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

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

Note: 2>,&> will overwrite the contents of the source file.

>file# #清空file


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

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

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


Note:>> 2>> &>> does not overwrite the contents of the source file, it will characters the corresponding output word to the end of the file.



650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9C/46/wKioL1luLUSAIhniAAEmwDuqBn8248.png-wh_500x0-wm_ 3-wmp_4-s_3932810046.png "title=" UD ' 13h{1w[3lule@ ' he1$qa.png "alt=" wkiol1lulusaihniaaemwduqbn8248.png-wh_50 "/ >


| The function of a pipe is to change the output of the previous command into the input of the post-pipeline command.


Ls/bin | Wc-l# #统计ls The number of lines that the/bin command outputs


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.

Tee Copy output to specified location

Date |tee file |wc-l# # #tee命令复制date命令的输出到file中, and count the number of output rows

1.vim Command mode


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的配置文件, at the end of this file add the above parameters, add to the number of files do not need:



2.vim Command mode keyword search

/keywords

N Match down

N Up match

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9C/47/wKiom1luLqWA5mqDAAWiNXuWZR8588.png-wh_500x0-wm_ 3-wmp_4-s_293083825.png "title=" S~{{2c153stw2eeh ' W94afg.png "alt=" Wkiom1lulqwa5mqdaawinxuwzr8588.png-wh_50 "/>


Character Management in 3.vim command mode

1. Copying of characters

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 a paste action


4.vim Visualization Mode


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


5. Bulk modification of characters


:%s/original character/replace character # #只替换每一行中出现的第一个原有字符

:%s/original character/replace character/g # #替换所有

:%s/^\ *//g# #把全文行首的空格去掉, "^\ *" indicates the space at the beginning of the line


6.vim Split-screen function

Ctrl+w s # # #上下分屏

Ctrl+w v# # #左右分屏

Ctrl+w c# # #关闭光标所在屏幕

Ctrl+w up or down # # #光标移动到指定屏幕

: SP file2# #同时编辑当前文件和file2

7.vim cursor Movement

in command mode

: Number # #移动到指定的行

G# #文件最后一行

GG# #文件第一行


In insert mode

I# #光标所在位置插入

I# #光标所在行行首

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

A# #光标所在行行尾

o# #光标所在行下一行

O# #光标所在行上一行

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

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


Exit mode of 8.vim

: Q# #当用vim打开文件但没有对字符作任何操作时可直接退出

: q! # #当用vim打开文件并对字符作操作, quit all operations

: Wq# #保存退出

: wq! # #强行保存退出, effective for Superuser and file owner


9.vim Manual

Vimtutor# #vim的手册

: Q# #退出vimtutor

3.gedit

CTRL+ N # #在gedit中打开一个新的tab

Ctrl+s# #保存文件

Ctrl+o# #打开文件

Ctrl+x# #剪切字符

Ctrl+ V # #粘贴字符

CTRL+ C # #复制字符

Yelp Help:gedit# #gedit的图形手册















Management input and output of operation and maintenance learning and vim editing mode

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.