Linux Rookie Learning Path >>4

Source: Internet
Author: User


# # 1 # # Management 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 passwd2> File # #重定向错误输出
Find/etc-name passwd &> File # #重定向所有输出
Note:2>,&> will overwrite source file contents
>file # #清空file
Find/etc-name passwd >> File # #追加正确输出
Find/etc-name passwd2>> File # #追加错误输出
Find/etc-name passwd &>> File # #追加所有输出
Note:>>2>> &>> does not overwrite the source file content, 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.
Use2>&1The wrong output number can be changed 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

# 2 # # 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-keyword search in vim command mode
/keywords
N Match down
N Up match


####3 Management of characters in the. Vim Command mode
1 . Copying of characters
YL # #复制一个字母
y3l # # Copy 3 Letters
YW # #复制一个单词
y3w # #复制3个单词
yy # #复制一行
y3y # #复制3行
P # #复制完成后按 "P" Paste
2 . Character deletion
DL # #删除一个字母
d3l # #删除3个字母
DW # #删除一个单词
d3w # #删除3个单词
DD # #删除一行
D3D # #删除3行
3 . Character Cut
Cl # #剪切一个字母
c3l # #剪切3个字母
CW # #剪切一个单词
c3w # #剪切3个单词
cc # #剪切一行
c3c # #剪切3行
ESC--- > P # #剪切过后会进入到插入模式, be sure to exit Insert mode

When you perform 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 modifier 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's split screen function
Ctrl+w S # # #上下分屏
Ctrl+w V # # #左右分屏
Ctrl+w C # # #关闭光标所在屏幕
Ctrl+w up or down # # #光标移动到指定屏幕


####7 . VIM cursor moves
in command mode
: Number # #移动到指定的行
G # #文件最后一行
GG # #文件第一行
in insert mode
i # #光标所在位置插入
i # #光标所在行行首
A # # Next position of the character where the cursor is located
A # #光标所在行行尾
O # #光标所在行下一行
O # #光标所在行上一行
S # #删除光标所在字符插入
S # #删除光标所在行插入


# # # #8. Vim's exit mode
: Q # #当用vim打开文件但没有对字符作任何操作时可直接退出
: q! # #当用vim打开文件并对字符作操作, quit all operations
: Wq # #保存退出
: wq! # #强行保存退出, effective for Superuser and file owner
# # # #9. Vim Handbook # # #
Vimtutor # #vim的手册
: Q # #退出vimtutor
# 3 #gedit #
CTRL + N # #在gedit中打开一个新的tab
Ctrl+s # #保存文件
Ctrl+o # #打开文件
Ctrl+x # #剪切字符
Ctrl + V # #粘贴字符
CTRL + C # #复制字符
Yelp Help:gedit # #gedit的图形手册
# #end # #

Linux Rookie Learning Path >>4

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.