Basic Linux Learning (13) Common Search commands

Source: Internet
Author: User
Tags diff

# # #1. diff###

diff File File1 # #比较两个文件的不同

-C # #显示周围的行

-U # #按照一定格式统一输出生成补丁

-R # #比较两个目录中文件的不同

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/FA/wKioL1gjB-LwFmMuAABax49YhII171.png-wh_500x0-wm_3 -wmp_4-s_276949064.png "style=" Float:none; "title=" 2016-11-09 19:25:22 screen. png "alt=" Wkiol1gjb-lwfmmuaabax49yhii171.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/FD/wKiom1gjB-LRawdhAABXc1RcCYI032.png-wh_500x0-wm_3 -wmp_4-s_3510033036.png "style=" Float:none; "title=" 2016-11-09 19:23:30 screen. png "alt=" Wkiom1gjb-lrawdhaabxc1rccyi032.png-wh_50 "/>


Patch File File.path # #打补丁

-B # #备份原文件


# # #2. grep###

grep Key Character File | Directory # #在文件或目录中查找含有关键字的行

Grep-i # #忽略大小写

-N # #显示关键字所在行

-C # #显示过滤结果的个数

-V # #反向过滤

-e "keyword 1| keyword 2" # #过滤多个关键字

-R Directory # #在目录中查找含有关键字的文件

Note: ^ keyword # #以关键字开头

Keyword $ # #以关键字结尾

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/09/wKioL1gkkLCgUY9LAAPkYsXScK8405.png-wh_500x0-wm_3 -wmp_4-s_3803988628.png "title=" screenshot from 2016-11-05 01-19-34.png "alt=" Wkiol1gkklcguy9laapkysxsck8405.png-wh _50 "/>


# # #3. cut###

Cut # #截取字符

cut-d Delimiter # #指定分隔符

Cut-f 1,7 # #显示制定的列

Cut-c 1-4 # #显示指定的字符


# # #4. sort### # #排序

Cp/etc/passwd/mnt

vim/mnt/passwd

Sort-n # #纯数字排序

-U # #去冗余

|UNIQ-C # #去除冗余并统计冗余次数

-T # #指定分隔符

-K # #制定列

# # #5. uniq###

Sort file |uniq-c # #去除冗余并统计冗余次数

-D # #显示冗余行

-U displays unique rows

# # #6. sed###

Sed ' s/original character/replacement character/g ' file

Sed-e ' policy '-e ' strategy 2 ' file

Sed-i File # #把转换后的内容输入到指定文件

Sed ' 3,5s/meta character/replacement character/g ' # #3-5 line replacement

Sed xd # #屏蔽制定行

Sed XP # #复制制定行





Basic Linux Learning (13) Common Search commands

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.