sort\u547d\u4ee4\u7528\u6765\u5bf9\u6587\u4ef6\u5185\u5bb9\u8fdb\u884c\u6392\u5e8f\u3002\u521b\u5efa\u4e00\u4e2a\u540d\u4e3atest.txt\u7684\u6587\u4ef6\uff0c\u5e76\u4e14\u628a\u4ee5\u4e0b\u5185\u5bb9\u62f7\u8d1d\u5230\u8be5\u6587\u4ef6\u4e2d\uff1a<\/p>\n
1 mike level intermediate jan 10 lucy level beginer mar 45 Dave level expert dec 4 dennis start beginner jul 7 Megan employee trainee feb 58 Mathew Head CEO nov<\/pre>\n\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u7b2c\u4e8c\u5217\u662f\u540d\u79f0\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u60f3\u5bf9\u540d\u79f0\u5217\u6309\u5b57\u6bcd\u6392\u5e8f\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u201c-k\u201d\u9009\u9879\uff0c\u5e76\u6807\u6ce8\u5217\u53f7\uff0c\u6bd4\u5982\u201c-k2\u201d\uff1a<\/p>\n
\u8bed\u6cd5: sort sort -k2 test.txt<\/p>\n
\u6392\u5e8f\u7ed3\u679c<\/p>\n
~# sort -k2 test.txt 45 Dave level expert dec 4 dennis start beginner jul 10 lucy level beginer mar 58 Mathew Head CEO nov 7 Megan employee trainee feb 1 mike level intermediate jan<\/pre>\n\u7b2c\u4e00\u5217\u662f\u6570\u5b57\uff0c\u5982\u679c\u4f60\u60f3\u6309\u6570\u5b57\u6392\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u201c-h\u201d\u9009\u9879\u3002\u5982\u679c\u6570\u5b57\u5728\u4e0d\u540c\u5217\u4e0a\uff0c\u4f60\u53ef\u4ee5\u5728\u201c-h\u201d\u9009\u9879\u540e\u4f7f\u7528\u201c-k\u201d\u9009\u9879\uff1a<\/p>\n
~# sort -h test.txt 1 mike level intermediate jan 4 dennis start beginner jul 7 Megan employee trainee feb 10 lucy level beginer mar 45 Dave level expert dec 58 Mathew Head CEO nov<\/pre>\n\u6700\u540e\u4e00\u5217\u662f\u6708\u4efd\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u201c-M\u201d\u9009\u9879\u6765\u8ba9\u6587\u4ef6\u5185\u5bb9\u6309\u6708\u4efd\u6392\u5e8f\uff1a<\/p>\n
~# sort -k5 -M test.txt 1 mike level intermediate jan 7 Megan employee trainee feb 10 lucy level beginer mar 4 dennis start beginner jul 58 Mathew Head CEO nov 45 Dave level expert dec<\/pre>\n\u6ce8\uff1a\u5982\u679c\u4f60\u60f3\u6d88\u9664\u91cd\u590d\u7684\u884c\uff0c\u53ef\u4ee5\u5728sort\u547d\u4ee4\u540e\u4f7f\u7528\u201c-u\u201d\u9009\u9879\u3002<\/p>\n
\u4f7f\u7528\u201c-r\u201d\u9009\u9879\uff0c\u662f\u6587\u4ef6\u5012\u5e8f\u6392\u5217\uff1a<\/p>\n
~# sort -h -r test.txt 58 Mathew Head CEO nov 45 Dave level expert dec 10 lucy level beginer mar 7 Megan employee trainee feb 4 dennis start beginner jul 1 mike level intermediate jan<\/pre>\nGrep\u547d\u4ee4\uff1a<\/strong><\/div>\nGrep\u547d\u4ee4\u975e\u5e38\u5f3a\u5927\uff0c\u7cfb\u7edf\u7ba1\u7406\u5458\u7ecf\u5e38\u4f1a\u7528\u5230\u5b83\u3002grep\u547d\u4ee4\u53ef\u4ee5\u5728\u6587\u4ef6\u4e2d\u641c\u7d22\u6307\u5b9a\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\uff0c\u540c\u65f6\u5bf9\u5176\u8fdb\u884c\u6807\u51c6\u8f93\u51fa\u3002<\/p>\n
\u8bed\u6cd5: grep \"\" grep \"Mathew\" test.txt<\/p>\n
~# grep \"dennis\" test.txt 4 dennis start beginner jul<\/pre>\n\u4e0a\u9762\u547d\u4ee4\u7684\u8f93\u51fa\u7ed3\u679c\u662f\u5305\u542b\u8be5\u5b50\u5b57\u7b26\u4e32\u7684\uff0c\u5982\u679c\u4f60\u60f3\u68c0\u7d22\u5b8c\u6574\u7684\u5355\u8bcd\uff0c\u4f60\u9700\u8981\u6dfb\u52a0\u201c-i\u201d\u9009\u9879\u3002\u540c\u65f6\uff0c\u4e5f\u53ef\u4ee5\u7528grep\u547d\u4ee4\u5728\u591a\u4e2a\u6587\u4ef6\u4e2d\u641c\u7d22\u5b57\u7b26\u4e32\uff0c\u547d\u4ee4\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n
while(!game_over) { for each possible move: count_no_of_merges_for_2-tiles and 4-tiles choose the move with large number of merges }<\/pre>\ngrep \"dennis\" test1.txt test2.txt test3.txt<\/pre>\n\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u5b57\u7b26\u4e32\u3002<\/p>\n
4\u3001cut\u547d\u4ee4<\/strong><\/div>\ncut\u547d\u4ee4\u53ef\u4ee5\u8ba9\u4f60\u7528\u5217\u6216\u8005\u5206\u9694\u7b26\u63d0\u53d6\u6587\u4ef6\u4e2d\u7684\u6307\u5b9a\u90e8\u5206\u3002\u5982\u679c\u4f60\u8981\u5217\u51fa\u6587\u4ef6\u4e2d\u67d0\u5217\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528\u201c-c\u201d\u9009\u9879\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u5c06\u4ecetest.txt\u6587\u4ef6\u4e2d\u63d0\u53d6\u7b2c1\u30012\u5217\u7684\u5168\u90e8\u5185\u5bb9\u3002<\/p>\n
cut -c1-2 test.txt\r\n~# cut -c1-2 test.txt 1 10 45 4 7 58<\/pre>\n\u5982\u679c\u4f60\u5e0c\u671b\u4ece\u6587\u4ef6\u4e2d\u63d0\u53d6\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u4f7f\u7528\u5206\u9694\u7b26\u9009\u9879\u201c-d\u201d\u548c\u201c-f\u201d\u9009\u9879\u9009\u4e2d\u5217\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528cut\u547d\u4ee4\u63d0\u53d6names\u5217\uff1a<\/p>\n
cut -d' ' -f2 test.txt\r\n~# cut -d' ' -f2 test.txt mike lucy Dave dennis Megan Mathew<\/pre>\n\u4e0b\u9762\u7684\u4f8b\u5b50\u4ece\/etc\/passd file\u4e2d\u63d0\u53d6users\u5217\uff1a<\/p>\n
cut -d':' -f1 \/etc\/passwd<\/pre>\n5\u3001sed\u547d\u4ee4<\/strong><\/div>\nsed \u662f\u4e00\u79cd\u5728\u7ebf\u7f16\u8f91\u5668\uff0c\u5b83\u4e00\u6b21\u5904\u7406\u4e00\u884c\u5185\u5bb9\u3002\u5904\u7406\u65f6\uff0c\u628a\u5f53\u524d\u5904\u7406\u7684\u884c\u5b58\u50a8\u5728\u4e34\u65f6\u7f13\u51b2\u533a\u4e2d\uff0c\u79f0\u4e3a\u201c\u6a21\u5f0f\u7a7a\u95f4\u201d\uff08pattern space\uff09\uff0c\u63a5\u7740\u7528sed\u547d\u4ee4\u5904\u7406\u7f13\u51b2\u533a\u4e2d\u7684\u5185\u5bb9\uff0c\u5904\u7406\u5b8c\u6210\u540e\uff0c\u628a\u7f13\u51b2\u533a\u7684\u5185\u5bb9\u9001\u5f80\u5c4f\u5e55\u3002\u63a5\u7740\u5904\u7406\u4e0b\u4e00\u884c\uff0c\u8fd9\u6837\u4e0d\u65ad\u91cd\u590d\uff0c\u76f4\u5230\u6587\u4ef6\u672b\u5c3e\u3002\u6587\u4ef6\u5185\u5bb9\u5e76\u6ca1\u6709 \u6539\u53d8\uff0c\u9664\u975e\u4f60\u4f7f\u7528\u91cd\u5b9a\u5411\u5b58\u50a8\u8f93\u51fa\u3002<\/p>\n
\u5982\u679c\u4f60\u60f3\u901a\u8fc7\u641c\u7d22\u66ff\u6362\u6587\u4ef6\u4e2d\u7684\u6307\u5b9a\u5185\u5bb9\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u201cs\u201d\u9009\u9879\u6765\u68c0\u7d22\u5230\u5b83\u7136\u540e\u5c06\u5b83\u66ff\u6362\u3002<\/p>\n
\u8bed\u6cd5: sed 's\/\/\/' test.txt<\/p>\n
\u4f8b\u5982\uff0c\u5728test.txt\u6587\u4ef6\u4e2d\u7528\u201cmichael\u201d\u66ff\u6362\u201cmike\u201d\uff1a<\/p>\n
sed 's\/mike\/michael\/' test.txt\r\n~# sed 's\/mike\/michael\/' test.txt 1 michael level intermediate jan 10 lucy level beginer mar 45 Dave level expert dec 4 dennis start beginner jul 7 Megan employee trainee feb 58 Mathew Head CEO nov<\/pre>\n6\u3001tar\u547d\u4ee4<\/strong><\/div>\ntar\u547d\u4ee4\u7528\u6765\u538b\u7f29\u548c\u89e3\u538b\u7f29\u6587\u4ef6\uff0c\u5176\u4e2d\u7ecf\u5e38\u4f1a\u7528\u5230\u201c-cf\u201d\u548c\u201c-xf\u201d\u9009\u9879\u3002<\/p>\n
\u8bed\u6cd5: tar<\/p>\n
\u8ba9\u6211\u4eec\u5c06test.txt\u6587\u4ef6\u6253\u5305\uff1a<\/p>\n
tar -cf test.tar test.txt\r\n~# tar -cf test.tar test.txt root@devopscube:~# ls test.tar test.txt<\/pre>\n\u7528\u201c-C\u201d\u9009\u9879\u5c06\u521a\u624d\u6253\u5305\u597d\u7684test.tar\u6587\u4ef6\u89e3\u538b\u7f29\u81f3\u201cdemo\u201d\u76ee\u5f55\uff1a<\/p>\n
tar -xf test.tar -C \/root\/demo\/\r\n~# tar -xf test.tar -C \/root\/demo\/ root@devopscube:~# cd demo\/ root@devopscube:~\/demo# ls test.txt<\/pre>\n7\u3001find\u547d\u4ee4<\/strong><\/div>\nfind\u547d\u4ee4\u7528\u6765\u68c0\u7d22\u6587\u4ef6\uff0c\u53ef\u4ee5\u7528\u201c-name\u201d\u9009\u9879\u6765\u68c0\u7d22\u6307\u5b9a\u540d\u79f0\u7684\u6587\u4ef6\uff1a<\/p>\n
find -name find -name test.txt\r\n~#\/home\/ubuntu# cd ~ root@devopscube:~# find -name test.txt .\/demo\/test.txt .\/test.txt<\/pre>\n\u4f60\u4e5f\u53ef\u4ee5\u7528\u201c\/ -name\u201d\u6765\u68c0\u7d22\u6307\u5b9a\u540d\u79f0\u7684\u6587\u4ef6\u5939\uff1a<\/p>\n
find \/ -name passwd\r\n~# find \/ -name passwd \/etc\/cron.daily\/passwd \/etc\/pam.d\/passwd \/etc\/passwd \/usr\/share\/lintian\/overrides\/passwd<\/pre>\n8\u3001diff\u547d\u4ee4<\/strong><\/div>\ndiff\u547d\u4ee4\u7528\u6765\u627e\u51fa2\u4e2a\u6587\u4ef6\u7684\u4e0d\u540c\u70b9\u3002diff\u547d\u4ee4\u901a\u8fc7\u5206\u6790\u6587\u4ef6\u5185\u5bb9\uff0c\u7136\u540e\u5c06\u4e0d\u540c\u7684\u884c\u6253\u5370\u51fa\u6765\uff0c\u4e0b\u9762\u7684\u4f8b\u5b50\u53ef\u4ee5\u627e\u51fa\u4e24\u4e2a\u6587\u4ef6test\u548ctest1\u7684\u4e0d\u540c\u70b9<\/p>\n
\u8bed\u6cd5: diff diff test.txt test1.txt<\/p>\n
~# diff test.txt test1.txt 7c7 < 59 sdfsd --- > 59 sdfsd CTO dec<\/pre>\n9\u3001Uniq\u547d\u4ee4<\/strong><\/div>\nuniq\u547d\u4ee4\u7528\u6765\u8fc7\u6ee4\u6587\u4ef6\u4e2d\u7684\u91cd\u590d\u884c\uff1a<\/p>\n
\u8bed\u6cd5: uniq uniq test.txt<\/p>\n
~# uniq test.txt 1 mike level intermediate jan 10 lucy level beginer mar 45 Dave level expert dec 4 dennis start beginner jul 7 Megan employee trainee feb 58 Mathew Head CEO nov<\/pre>\n10\u3001chmod\u547d\u4ee4<\/strong><\/div>\nchmod\u547d\u4ee4\u7528\u6765\u6539\u53d8\u6587\u4ef6\u7684\u8bfb\/\u5199\/\u6267\u884c\u6743\u9650\uff0c\u6743\u9650\u6570\u503c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
4 - read permission 2 - write permission 1 - execute permission 0 - no permission<\/p>\n
\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u7ed9test.txt\u6587\u4ef6\u8d4b\u6700\u9ad8\u7684\u6743\u9650\uff1a<\/p>\n
chmod 755 test.txt<\/pre>\n","protected":false},"excerpt":{"rendered":"\u4ee5\u4e0b\u5c31\u662f\u4eca\u5929\u6211\u4eec\u8981\u4ecb\u7ecd\u7684Linux\u547d\u4ee4\uff1a man touch, cat and less sort and g […]<\/p>\n","protected":false},"author":310,"featured_media":251879,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-251793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/251793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=251793"}],"version-history":[{"count":25,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/251793\/revisions"}],"predecessor-version":[{"id":252049,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/251793\/revisions\/252049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/251879"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=251793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=251793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=251793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}