Three or four unit (man vim management input and output)

Source: Internet
Author: User

Unit Three


1. Man

Man->>manual # # #man是手册缩写

Man Man # # # # #查看man命令的帮助

Man passwd # # #查看passwd命令的帮助

The level of man

1 system commands

2 System interface

3 Function libraries

4 special files, such as device files

5 files

6 games

7 Package for the system

8 System Administration Commands

9 cores

Man 5 passwd # help #查看/etc/passwd file

Man 1 passwd # #查看passwd命令的帮助, 1 can be omitted

A shortcut to the man page

Down Key # #向上或向下一行

Pageup|pagedown # #向下一个屏幕或者向上一个屏幕

D|u # #向下或者向上半个屏幕

G|GG # #跳转页面到man最下面或最上面

/keyword # #搜索关键字, keywords are highlighted, n is matched, n up

Q # #退出帮助页面

Unit Four

I. 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

Find/etc-name passwd

Because the student user rights issue will have the following output

Find: '/etc/pki/ca/private ': Permission denied # #没有进入权力, error

Find: '/etc/pki/rsyslog ': Permission denied

Find: '/etc/audit ': Permission denied

/ETC/PASSWD # #正确输出

Find: '/ETC/POLKIT-1/RULES.D ': Permission denied

Find: '/etc/polkit-1/localauthority ': Permission denied

Find: '/etc/dhcp ': Permission denied

Find: '/etc/selinux/targeted/modules/active ': Permission denied

Find: '/etc/lvm/archive ': Permission denied

Find: '/etc/lvm/backup ': Permission denied

Find: '/etc/lvm/cache ': Permission denied

Find: '/ETC/GRUB.D ': Permission denied

/ETC/PAM.D/PASSWD # #正确输出

Find: '/etc/audisp ': Permission denied

Find: '/etc/firewalld ': Permission denied

Find: '/etc/cups/ssl ': Permission denied

Find: '/etc/ipsec.d ': Permission denied

Find: '/etc/libvirt ': Permission denied

Find: '/ETC/SUDOERS.D ': Permission denied

Find: '/etc/named ': Permission denied

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.

| 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

Two. Vim

# # # #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

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/\t//g # #把全文的tab键替去掉, \ t = Tab key

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

:%s/^\#\ */#/g # #把全文 # After the space is removed

6.vim Split-screen function

Ctrl+w S # # #上下分屏

Ctrl+w V # # #左右分屏

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

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

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 Handbook # # #

Vimtutor # #vim的手册

: Q # #退出vimtutor

Three. Gedit

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

Ctrl+s # #保存文件

Ctrl+o # #打开文件

Ctrl+x # #剪切字符

Ctrl + V # #粘贴字符

CTRL + C # #复制字符

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

# #end # #


Three or four unit (man vim management input and output)

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.