{"id":116080,"date":"2018-09-01T08:28:00","date_gmt":"2018-09-01T00:28:00","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=116080"},"modified":"2018-08-24T09:28:57","modified_gmt":"2018-08-24T01:28:57","slug":"linux-noticed-cmd","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-noticed-cmd.html","title":{"rendered":"\u5217\u4e3e\u4e00\u4e0b\u4f60\u53ef\u80fd\u6ca1\u6ce8\u610f\u7684Linux\u547d\u4ee4"},"content":{"rendered":"

\u8fd9\u7bc7\u6587\u7ae0\u4ec5\u8ba8\u8bba Linux \u73af\u5883\u4e0b\u7684\u4e1c\u897f\uff0c\u5f88\u663e\u7136\u5bf9 MacOS \u4e5f\u9002\u7528\u3002\u5176\u5b9e\u5f88\u591a\u4e1c\u897f\u867d\u7136\u6709 Windows \u4e5f\u53ef\u4ee5\u627e\u7684\u5230\u4f46\u914d\u7f6e\u6bd4\u8f83\u9ebb\u70e6\uff0c\u8fd9\u91cc\u4e0d\u518d\u4ed4\u7ec6\u8bb2\u3002\u5f88\u591a\u4e1c\u897f\u50cf Linux \u8001\u9e1f\u770b\u8d77\u6765\u4f1a\u89c9\u5f97\u54c8\u54c8\u54c8\u5b9e\u5728\u662f\u592a\u57fa\u7840\u3002\u4f46\u662f\u50cf cd, ls, mkdir \u8fd9\u4e9b\u592a\u57fa\u7840\u7684\u5199\u5728\u8fd9\u91cc\u53c8\u663e\u5f97\u592a\u4e1a\u4f59\uff0c\u6240\u4ee5\u5f88\u591a\u5341\u5206\u5e38\u7528\u7684\u547d\u4ee4\u8fd9\u8fb9\u6211\u4e5f\u8df3\u8fc7\u4e86\u3002\u50cfgit\u8fd9\u79cd\u91cd\u91cf\u7ea7\u7684\u5de5\u5177\uff0c\u548csed,awk\u8fd9\u4e9b\u80fd\u5355\u72ec\u51fa\u4e66\u7684\u4e1c\u897f\u6211\u89c9\u5f97\u6211\u4e5f\u8bb2\u4e0d\u6e05\u695a\uff0c\u6240\u4ee5\u8fd9\u8fb9\u90fd\u662f\u529f\u80fd\u7b80\u5355\u7684\u5c0f\u4e1c\u897f\u3002\u4e0d\u8fc7\u8fd9\u4e9b\u5c0f\u95ee\u9898\u5c31\u7b97\u4e86\u5427...<\/p>\n

\u5982\u679c\u4f60\u65f6\u95f4\u6bd4\u8f83\u5145\u88d5<\/strong><\/div>\n

\u90a3\u4e48\u4e0d\u5982\u770b\u770b\u8fd9\u672c\u4e66\u5427: <<The Linux Command Line>>\u3002\u4e66\u7684\u5185\u5bb9\u5c31\u8ddf\u6807\u9898\u4e00\u6837\uff0c\u6df1\u5165\u6d45\u51fa\u7684\u4ecb\u7ecd\u4e86\u6240\u8c13 \"Linux \u547d\u4ee4\u884c\" \u7684\u65b9\u65b9\u9762\u9762\uff0c\u672c\u6587\u5f88\u591a\u5185\u5bb9\u4e5f\u662f\u4ece\u4e66\u91cc\u770b\u5230\u7684\u3002\u7f51\u7ad9\u4e0a\u6709 PDF \u5408\u6cd5\u514d\u8d39\u4e0b\u8f7d\uff0c\u4e66\u5199\u7684\u5f88\u597d\u53ef\u4ee5\u5f88\u968f\u610f\u7684\u770b\u4e0d\u4f1a\u89c9\u5f97\u538b\u529b\u592a\u5927\u3002\u6700\u4e3b\u8981\u7684\uff0c\u5982\u679c\u4f60\u662f\u521a\u521a\u63a5\u89e6 Linux \u90a3\u4e48\u8fd9\u4e2a\u8bf4\u4e0d\u5b9a\u662f\u6700\u597d\u7684\u4e0a\u624b\u6559\u7a0b\uff0c\u6211\u5341\u5206\u540e\u6094\u539f\u6765\u4e0d\u77e5\u9053\u8fd9\u4e48\u4e66\u3002\u8fd9\u4e48\u8bf4\u8d77\u6765\u53e6\u5916\u4e00\u672c Linux \u5165\u95e8\u5927\u5e08\u7ea7\u6559\u7a0b\u5e94\u8be5\u662f\u9e1f\u54e5\u79c1\u623f\u83dc\uff0c\u8fd9\u4e2a\u5b9e\u5728\u662f\u592a\u51fa\u540d\u4ee5\u81f3\u4e8e\u6211\u89c9\u5f97\u6ca1\u4ec0\u4e48\u53ef\u4ee5\u8bf4\u7684\u3002<\/p>\n

\u5982\u679c\u4f60\u6ca1\u4ec0\u4e48\u7a7a\u7684\u8bdd<\/strong><\/div>\n

\u90a3\u4e0b\u9762\u5c31\u4ee5\u968f\u673a\u7684\u987a\u5e8f\u5217\u51fa\u4e00\u4e9b\u6211\u89c9\u5f97\u975e\u5e38\u68d2\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u8fd9\u91cc\u4e0d\u8be6\u7ec6\u4ecb\u7ecd\u5404\u79cd\u53c2\u6570\uff0c\u4f60\u5e94\u8be5\u505a\u7684\u662f\u7528 man xxx \u6765\u67e5\u770b\u6587\u6863\u3002\u5982\u679c\u8fd9\u4e9b\u7a0b\u5e8f\u5728\u4f60\u7684\u53d1\u884c\u7248\u91cc\u6ca1\u6709\u5b89\u88c5\uff0c\u90a3\u4e48\u8bf7\u624b\u52a8\u641c\u4e00\u4e0b\u3002Mac \u7528\u6237\u7684\u8bdd\u5728 homebrew \u91cc\u53ef\u4ee5\u5e94\u8be5\u90fd\u80fd\u627e\u5230\u3002<\/p>\n

tmux<\/strong><\/span><\/div>\n

\u867d\u7136\u8bf4\u987a\u5e8f\u5f88\u968f\u673a\u4f46\u8fd9\u4e00\u6761\u4e00\u5b9a\u5f97\u6392\u5728\u7b2c\u4e00\u4e2a\u3002\u5f88\u591a\u4eba\u7528 Linux \u7684\u72b6\u6001\u90fd\u662f\u81ea\u5df1\u7684\u673a\u5668\u662f Windows\uff0c\u7528 putty \u8fde\u5230\u4e00\u4e2a\u54ea\u91cc\u7684 Linux \u670d\u52a1\u5668\u8fdb\u884c\u5de5\u4f5c\u3002\u8fd9\u6837\u7684\u8bdd\u6bcf\u6b21\u65ad\u5f00\u7684\u65f6\u5019\u4f60\u8fd0\u884c\u7684\u7a0b\u5e8f\u90fd\u662f\u4f1a\u88ab\u6740\u6389\u7684\u3002\u4f60\u53ef\u80fd\u4f1a\u5e0c\u671b\u9000\u51fa\u7684\u65f6\u5019\u80fd\u628a\u6253\u5f00\u7684\u7a0b\u5e8f\u4fdd\u6301\u5728\u90a3\u91cc\uff0c\u4e0b\u6b21\u7528\u8fde\u63a5\u7684\u65f6\u5019\u53c8\u80fd\u81ea\u52a8\u5230\u4e4b\u524d\u7684\u5de5\u4f5c\u72b6\u6001\u3002tmux \u5c31\u662f\u8fd9\u4e2a\u95ee\u9898\u7684\u7ec8\u6781\u89e3\u51b3\u65b9\u6848\u3002\u5b83\u4eec\u4e00\u65b9\u9762\u7684\u529f\u80fd\u662f\u80fd\u5728\u4e00\u4e2a Terminal \u91cc\u521b\u5efa\u591a\u4e2a\u201c\u7a97\u53e3\u201d\uff0c\u53e6\u4e00\u65b9\u9762\u5982\u679c\u4f60\u5173\u95ed\u8fde\u63a5\u6216\u8005\u610f\u5916\u6389\u7ebf\uff0c\u5b83\u4eec\u9ed8\u8ba4\u4e5f\u4e0d\u4f1a\u5173\u6389\uff0c\u4e0b\u6b21\u8fde\u4e0a\u53bb\u53ef\u4ee5\u7528 tmux attach \u6765\u6062\u590d\u4f60\u4e4b\u524d\u7684\u5de5\u4f5c\u72b6\u6001\u3002<\/p>\n

\u5982\u679c\u4f60\u6ca1\u542c\u8bf4\u8fc7\u8fd9\u4e2a\u6216\u8005\u7c7b\u4f3c\u7684 screen \u7684\u8bdd\uff0c\u90a3\u4f60\u5e94\u8be5\u7ed9\u6211\u4e00\u70b9\u73b0\u91d1\u3002<\/p>\n

tree<\/strong><\/span><\/div>\n

ls \u53ef\u80fd\u662f\u4f60\u6700\u5e38\u7528\u7684\u547d\u4ee4\u4e4b\u4e00\u3002tree \u53ef\u4ee5\u9012\u5f52\u7684\u5217\u51fa\u76ee\u5f55\u4e0b\u6240\u6709\u7684\u6587\u4ef6\uff0c\u5e76\u4ee5\u6811\u72b6\u5f62\u5f0f\u5c55\u73b0\uff1a<\/p>\n

$ tree\r\n.\r\n\u251c\u2500\u2500 b\r\n\u251c\u2500\u2500 c\r\n\u2502   \u2514\u2500\u2500 d\r\n\u2514\u2500\u2500 what\r\n<\/pre>\n

\u5bf9\u5e94\u7684\u4e5f\u6709 pstree \u53ef\u4ee5\u4ee5\u8fd9\u6837\u7684\u65b9\u5f0f\u6765\u663e\u793a\u8fdb\u7a0b\u6811\u3002<\/p>\n

ack<\/strong><\/span><\/div>\n

\u6211\u8bb0\u5f97\u6211\u66fe\u7ecf\u5728\u9762\u8bd5\u7684\u65f6\u5019\u88ab\u95ee\u5230\u8fc7\u201c\u8bf7\u5199\u5982\u4f55\u8c03\u7528 grep \u6765\u5217\u51fa\u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\u91cc\uff0c\u542b\u6709\u67d0\u4e2a\u5b57\u7b26\u4e32\u7684\u884c\u201d\u3002\u8fd9\u4e2a\u95ee\u9898\u6211\u7684\u56de\u7b54\u662f \u201c\u7528 ack \u5c31\u53ef\u4ee5\u4e86\u201d\u3002ack \u7684\u5b98\u7f51\u57df\u540d\u5c31\u53eb betterthangrep.com\u3002\u7531\u4e8e\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u8f7d\u6240\u6709\u6587\u4ef6\u91cc\u67e5\u627e\u67d0\u4e2a\u5b57\u4e32\u7b26\u662f\u5982\u6b64\u5e38\u89c1\u7684\u4e00\u4e2a\u64cd\u4f5c\uff0c\u6267\u884c ack foo \u5c31\u53ef\u4ee5\u5728\u5f53\u524d\u76ee\u5f55\u6240\u6709\u6587\u4ef6\u91cc\u67e5\u627e foo\u3002ack \u9ed8\u8ba4\u4f1a\u8df3\u8fc7\u5f88\u591a\u6ca1\u7528\u7684\u76ee\u5f55\u548c\u6587\u4ef6\uff0c\u8ba9\u67e5\u627e\u66f4\u5feb\uff0c\u8f93\u51fa\u7ed3\u679c\u66f4\u51c6\u786e\u3002\u53e6\u5916\u50cf\u9ed8\u8ba4\u5f00\u542f\u7684\u5f69\u8272\u663e\u793a\u4e5f\u8ba9\u4eba\u7528\u8d77\u6765\u5f88\u8212\u7545\u3002<\/p>\n

ack \u76ee\u524d\u5927\u90e8\u5206\u53d1\u884c\u7248\u4e2d\u6ca1\u6709\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f Ubuntu \u7684\u8bdd\u5176\u5305\u88f9\u540d\u5b57\u662f ack-grep\uff0c\u6267\u884c\u6587\u4ef6\u7684\u540d\u5b57\u4e5f\u4e00\u6837\u3002\u5177\u4f53\u53ef\u4ee5\u5728\u8fd9\u91cc\u67e5\u770b\u6587\u6863\u3002<\/p>\n

rsync<\/strong><\/span><\/div>\n

\u6bd4\u5982\u8bf4\u4f60\u672c\u5730\u6709\u4e00\u53f0\u7535\u8111\uff0c\u8fdc\u7a0b\u6709\u4e00\u53f0\u670d\u52a1\u5668\u3002\u4f60\u60f3\u628a\u4f60\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\u5168\u90e8\u62f7\u8d1d\u5230\u53e6\u5916\u4e00\u8fb9\u7684\u67d0\u4e2a\u5730\u65b9\u53bb\u3002\u4f60\u8fd9\u4e2a\u6587\u4ef6\u5939\u7ecf\u5e38\u4e5f\u8981\u66f4\u65b0\uff0c\u5e0c\u671b\u901a\u8fc7\u67d0\u79cd\u65b9\u5f0f\u628a\u66f4\u65b0\u7684\u90e8\u5206\u80fd\u8fc5\u901f\u540c\u6b65\u8fc7\u53bb\u3002\u8fd9\u5e94\u8be5\u600e\u4e48\u505a\uff1f\u4e0d\u77e5\u9053 rsync \u7684\u8bdd\u4f60\u53ef\u80fd\u4f1a\u60f3\u7528 git\uff0c\u642d\u5efa\u4e00\u4e2a ftp\uff0c\u6216\u8005\u7528 scp \u6216\u8005\u522b\u7684\u3002\u4f46\u4e8b\u5b9e\u4e0a rsync \u624d\u662f\u771f\u6b63\u7684\u4e3a\u7cbe\u786e\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u800c\u751f\u7684\u8f6f\u4ef6\u3002rsync \u6700\u68d2\u7684\u5730\u65b9\u5c31\u662f\u5dee\u91cf\u66f4\u65b0\uff0c\u4e5f\u5c31\u662f\u53ea\u628a\u53e6\u5916\u4e00\u8fb9\u7f3a\u5c11\u7684\u4e1c\u897f\u4f20\u8fc7\u53bb\uff0c\u800c\u4e14\u4f60\u4e0d\u9700\u8981\u4efb\u4f55\u989d\u5916\u914d\u7f6e\uff0c\u901f\u5ea6\u5feb\u7684\u98de\u8d77\u3002\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n

< class=\"java\">rsync -arvuzp --chmod=g+rx .\/built\/ me@example<\/span>.com:\/var\/www\/site\r\n<\/pre>\n
aspell<\/strong><\/span><\/div>\n

\u4f5c\u4e3a\u4e00\u4e2a\u7a0b\u5e8f\u5458\u4f60\u603b\u6709\u4e00\u5929\u4f1a\u8981\u5199\u82f1\u6587\u6587\u6863\u3002\u6211\u7b49\u6bcd\u8bed\u4e0d\u662f\u82f1\u6587\u7684\u51fa\u73b0\u62fc\u5199\u9519\u8bef\u5b9e\u5728\u662f\u592a\u6b63\u5e38\u4e86\u3002\u5982\u679c\u4f60\u7528 Word \u7684\u8bdd\u4f1a\u6709\u4e0b\u5212\u7ebf\u63d0\u793a\u4f60\uff0c\u4f46\u5982\u679c\u4f60\u662f\u5728\u4ee3\u7801\u91cc\u5199\u6ce8\u91ca\u6216\u8005\u518d Linux \u4e0b\u5199 markdown \u7684\u8bdd\u597d\u50cf\u5c31\u6ca1\u4ec0\u4e48\u529e\u6cd5\u3002\u4e8b\u5b9e\u4e0a\u8fd9\u4e5f\u662f\u4e00\u4e2a\u5df2\u7ecf\u88ab\u89e3\u51b3\u7684\u95ee\u9898\uff0caspell \u6b63\u662f\u6765\u505a\u8fd9\u4e2a\u7684\u3002aspell \u53ef\u4ee5\u5bf9\u4efb\u4f55\u7eaf\u6587\u672c\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\uff0c\u4f5c\u4e3a\u9762\u5411\u7a0b\u5e8f\u5458\u7684\u5de5\u5177\u5b83\u53ef\u4ee5\u4fa6\u6d4b\u6587\u4ef6\u7c7b\u578b\uff0c\u6bd4\u5982\u5bf9 C++ \u7a0b\u5e8f\u5b83\u5c31\u53ea\u68c0\u67e5\u6ce8\u91ca\u91cc\u7684\u5355\u8bcd\u3002<\/p>\n

tee<\/strong><\/span><\/div>\n

\u6709\u65f6\u5019\u67d0\u4e9b\u547d\u4ee4\u8fd0\u884c\u7684\u7ed3\u679c\u4f1a\u5f88\u957f\uff0c\u4f60\u53ef\u80fd\u4f1a\u7528 less \u6765\u4e0a\u4e0b\u770b\u3002\u518d\u6216\u8005\u4f60\u53ef\u80fd\u4f1a\u7528 > \u6765\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u91cc\u3002\u4f46\u67d0\u4e9b\u65f6\u5019\u7a0b\u5e8f\u6709\u53ef\u80fd\u9700\u8981\u4f60\u8f93\u5165 y \u6765\u786e\u8ba4\uff0c\u6216\u8005\u67d0\u4e9b\u7a0b\u5e8f\u8fd0\u884c\u7684\u65f6\u95f4\u5f88\u957f\uff0c\u4ec5\u4ec5\u91cd\u5b9a\u5411\u7684\u8bdd\u53c8\u4e0d\u592a\u786e\u5b9a\u662f\u4e0d\u662f\u5b83\u5728\u6b63\u5e38\u8fd0\u884c\u3002tee \u5c31\u80fd\u505a\u5230\u53c8\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\uff0c\u53c8\u540c\u65f6\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u3002\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a<\/p>\n

echo<\/span> waht | tee out.txt\r\n<\/pre>\n

waht \u4f1a\u88ab\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\uff0c\u540c\u65f6\u4e5f\u4f1a\u88ab\u5199\u5230 out.txt \u6587\u4ef6\u91cc\u3002\u53e6\u5916 tee \u7684\u610f\u601d\u5176\u5b9e\u662f T\uff0c\u628a\u8f93\u5165\u8f93\u51fa\u4e2d\u95f4\u62c9\u4e86\u53c8\u591a\u626f\u51fa\u4e86\u4e00\u6761\uff0c\u53ef\u8c13\u662f\u76f8\u5f53\u5f62\u8c61\u3002<\/p>\n

\u503c\u5f97\u4e00\u63d0\u7684\u662f vim \u4e5f\u53ef\u4ee5\u7528\u5728 pipe \u91cc\uff0c\u4f8b\u5b50\u5982\u4e0b\uff1a<\/p>\n

$ echo<\/span> waht | vim -\r\n<\/pre>\n
<ctrl+r><\/strong><\/span><\/div>\n

\u4f60\u80af\u5b9a\u77e5\u9053\u7528\u952e\u76d8\u4e0a\u4e0b\u65b9\u5411\u952e\u53ef\u4ee5\u6765\u56de\u627e\u4f60\u7684\u5386\u53f2\uff0c\u90a3\u4e48\u6bd4\u5982\u6709\u4e00\u4e2a\u5f88\u4e45\u4e4b\u524d\u6253\u8fc7\u7684\u547d\u4ee4\u4f60\u53ef\u80fd\u9700\u8981\u731b\u6309\u4e0a\u624d\u80fd\u627e\u5230\u3002\u5176\u5b9e\u8fd9\u65f6\u5019\u53ea\u8981\u8f93\u5165\u4e00\u90e8\u5206\u7136\u540e\u6309 <ctrl+r> bash \u5c31\u4f1a\u5e2e\u4f60\u5f80\u56de\u641c\u7d22\u3002\u8fde\u7eed\u6309 <ctrl+r> \u53ef\u4ee5\u6309\u987a\u5e8f\u5f80\u524d\u641c\u3002(\u6216\u8005\u76f4\u63a5\u6309 <ctrl+r> \u518d\u8fdb\u884c\u8f93\u5165)\u3002\u63a5\u7740\u4e0a\u9762\u4e00\u4e2a\u7684\u4f8b\u5b50\uff0c\u8f93\u5165 echo \u540e\u6309 <ctrl+r> \u6548\u679c\u5982\u4e0b\uff1a<\/p>\n

(reverse-i-search)`echo<\/span>': echo waht | vim -\r\n<\/span><\/pre>\n

\u6709\u5f80\u524d\u641c\u7d22\u90a3\u4e48\u4e00\u822c\u5c31\u6709\u5f80\u540e\u641c\u7d22\u3002\u53ef\u60dc\u7684\u662f\u5f80\u540e\u641c\u7d22\u7684\u5feb\u6377\u952e\u662f <ctrl+s>\uff0c\u5982\u679c\u4f60\u8bd5\u7740\u6309\u4e00\u4e0b\u7684\u5c31\u4f1a\u53d1\u73b0...\u597d\u50cf\u673a\u5668\u6ca1\u53cd\u5e94\u4e86\u3002\u8fd9\u4e2a\u662f\u56e0\u4e3a <ctrl+s> \u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u9ed8\u8ba4\u662f XOFF<\/a>\uff0c\u4ee3\u8868\u6682\u505c\u63a5\u6536\u8f93\u5165\u3002\u6309 <ctrl+q> \u5c31\u80fd\u6062\u590d\u3002\u5f53\u7136\u4f60\u53ef\u4ee5\u628a\u5411\u524d\u641c\u7d22\u7ed1\u5b9a\u5230\u522b\u7684\u952e\u4e0a\uff0c\u8bf7\u81ea\u884c\u641c\u7d22\u3002<\/p>\n

cloc<\/strong><\/span><\/div>\n

\u867d\u8bf4\u4ee3\u7801\u884c\u6570\u4e0d\u80fd\u8bf4\u660e\u4efb\u4f55\u95ee\u9898\uff0c\u4f46\u6709\u65f6\u5019\u4e0d\u77e5\u4e3a\u4ec0\u5c31\u662f\u60f3\u77e5\u9053\u3002cloc \u80fd\u7cbe\u786e\u7684\u8ba1\u7b97\u4ee3\u7801\u884c\u6570\uff0c\u628a\u6ce8\u91ca\u548c\u7a7a\u683c\u90fd\u533a\u5206\u5f00\u3002\u5982\u679c\u4f60\u662f\u4e00\u540d\u4f20\u8bf4\u4e2d\u7684\u9879\u76ee\u7ecf\u7406\u7684\u8bdd\uff0c\u4ece\u4eca\u5929\u8d77\u5f00\u59cb\u7528 cloc \u7ed9\u4f60\u624b\u4e0b\u7684\u7801\u519c\u7b97\u5de5\u8d44\u5427\uff01\u4e0b\u9644\u622a\u5c4f\uff1a<\/p>\n

$ cloc \/usr\/include<\/span>\/\r\n    9628<\/span> text files.\r\n    9308<\/span> unique files.\r\n     434<\/span> files ignored.\r\n\r\nT=39.0<\/span> s (227.6<\/span> files\/s, 39948.2<\/span> lines\/s)\r\n-------------------------------------------------\r\nLanguage        files    blank  comment      code\r\n-------------------------------------------------\r\nC\/C++ Header     8875<\/span>   217366<\/span>   287013<\/span>   1053368<\/span>\r\nTeamcenter def<\/span>      1       48        0       186<\/span>\r\n-------------------------------------------------\r\nSUM:<\/span>             8876<\/span>   217414<\/span>   287013<\/span>   1053554<\/span>\r\n-------------------------------------------------\r\n<\/pre>\n
printenv<\/strong><\/span><\/div>\n

\u7528 set \u53ef\u4ee5\u67e5\u770b\u6240\u6709\u7684 Shell \u53d8\u91cf\u8fd8\u5305\u62ec Shell \u51fd\u6570\uff0c\u4f46\u662f\u5176\u4e2d\u6709\u4e00\u4e9b\u662f\u4ec5\u4ec5\u5728\u5f53\u524d shell \u91cc\u5176\u4f5c\u7528\u7684\u3002\u800c\u5f80\u5f80\u4f60\u9700\u8981\u627e\u7684\u662f\u901a\u8fc7 export \u6765\u5b9a\u4e49\u7684\u73af\u5883\u53d8\u91cf\u3002printenv \u5c31\u662f\u7528\u6765\u505a\u8fd9\u4e2a\u7684\u3002<\/p>\n

set -o vi<\/strong><\/span><\/div>\n

bash \u6216\u8005\u53ef\u80fd\u7edd\u5927\u591a\u6570\u5e38\u89c1 shell \u5176\u5b9e\u90fd\u662f\u652f\u6301\u7528 vi \u7684\u65b9\u5f0f\u8fdb\u884c\u547d\u4ee4\u884c\u7f16\u8f91\u7684\uff0c\u6bd4\u5982\u8bbe\u7f6e\u4e86 set -o vi \u540e\u4f60\u5c31\u53ef\u4ee5\u7528\u719f\u6089\u7684 hjkl \u6765\u79fb\u52a8\uff0c\u7528 w, b \u6765\u8df3\u8fc7\u5355\u8bcd\u7b49\u7b49\u3002<\/p>\n

\u540c\u6837\u7684\u5982\u679c\u4f60\u8bbe\u7f6e\u4e86 EDITOR \u73af\u5883\u53d8\u91cf\u7684\u8bdd\uff0c\u8f93\u5165 fc \u5c31\u53ef\u4ee5\u628a\u4e4b\u524d\u8f93\u5165\u7684\u547d\u4ee4\u884c\u653e\u5230\u7f16\u8f91\u5668\u91cc\u6765\u7f16\u8f91\uff0c\u53ea\u8981\u4fdd\u5b58\u4e86\u7684\u8bdd\u5c31\u4f1a\u6267\u884c\u3002\u76f8\u53cd\u7684\u653e\u5f03\u4fdd\u5b58\u5c31\u7b49\u4e8e\u662f\u653e\u5f03\u3002<\/p>\n

find<\/strong><\/span><\/div>\n

\u6211\u628a\u4e0a\u9762\u8bf4\u5230\u7684\u90a3\u672c\u4e66\u4ed4\u7ec6\u770b\u8fc7\u4ee5\u540e\uff0c\u6700\u5927\u7684\u6536\u83b7\u4e4b\u4e00\u5c31\u662f\u7ec8\u4e8e\u5b66\u4f1a\u4e86\u7528 find\u3002\u8fd9\u4e2a\u73b0\u5728\u53d8\u6210\u4e86\u6211\u51e0\u4e4e\u6bcf\u5929\u90fd\u5728\u7528\u7684\u4e00\u4e2a\u547d\u4ee4\u3002\u6bd4\u5982\u8bf4\u6211\u8981\u628a\u76ee\u5f55\u4e0b\u6240\u6709\u7684 png \u6587\u4ef6\u52a0\u5165\u5230\u8fd9\u6b21\u7684 git commit \u91cc\u9762\uff0c\u6211\u53ef\u4ee5\u7528:<\/p>\n

find . -name '*.png'<\/span> -exec<\/span> git add {} ';'<\/span>\r\n<\/pre>\n

\u5982\u679c\u4f60\u719f\u6089 find \u7684\u8bdd\u4f60\u4f1a\u77e5\u9053\u6700\u540e\u7684 ; \u53ef\u4ee5\u6362\u4e3a + \u4f1a\u66f4\u597d\uff0c\u4f46\u7528\u5b83\u5c31\u662f\u6709\u76ee\u7684\u7684\u3002\u8fd9\u4e2a\u547d\u4ee4\u867d\u7136\u770b\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u4f46\u91cc\u9762\u7684\u5355\u5f15\u53f7\u7701\u7565\u6216\u8005\u6362\u6210\u53cc\u5f15\u53f7\u547d\u4ee4\u90fd\u662f\u4f1a\u5931\u8d25\u7684\u3002\u8fd9\u4e9b\u7275\u6d89\u5230 \"shell variable expansion\" \u548c\u5f15\u53f7\u7684 escape \u89c4\u5219\uff0c\u867d\u7136\u611f\u89c9\u5f88\u607c\u706b\u4f46\u5176\u5b9e\u8fd9\u4e9b\u53ea\u6709\u51e0\u4e2a\u7b80\u5355\u7684\u89c4\u5219\uff0c\u800c\u4e14\u4e00\u81f4\u6027\u975e\u5e38\u597d\u3002\u6240\u4ee5\u53ea\u8981\u4f60\u80af\u82b1\u70b9\u65f6\u95f4\u628a\u76f8\u5173\u4e1c\u897f\u5f04\u6e05\u695a\uff0c\u8fd9\u79cd\u7b80\u5355\u7684\u95ee\u9898\u5c31\u53ef\u4ee5\u8f7b\u677e\u641e\u5b9a\u3002<\/p>\n

type<\/strong><\/span><\/div>\n

\u5982\u679c foo \u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u91cc\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u8bdd\uff0c\u4f60\u5e94\u8be5\u77e5\u9053\u7528 which foo \u53ef\u4ee5\u627e\u5230 foo \u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\u5728\u90a3\u91cc\u3002\u4f46\u5728\u547d\u4ee4\u884c\u91cc\u53ef\u4ee5\u6267\u884c\u7684\u547d\u4ee4\u5e76\u4e0d\u4e00\u5b9a\u90fd\u5bf9\u5e94\u5230\u67d0\u4e2a\u53ef\u6267\u884c\u7684\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u662f alias, shell \u81ea\u5e26\u7684\u51fd\u6570\u548c\u7528\u6237\u81ea\u5df1\u7684\u51fd\u6570\u7b49\u7b49\u3002\u6240\u4ee5\u6709\u65f6\u5019\u7528 which \u627e\u5230\u4e0d\u5230\u4e1c\u897f\u7684\u65f6\u5019\u4f1a\u8ba9\u4eba\u5f88\u7591\u60d1\u3002\u5176\u5b9e\u4f60\u53ef\u4ee5\u7528 type foo \u770b\u770b foo \u5230\u5e95\u662f\u4ec0\u4e48\u7c7b\u578b\u7684\u3002<\/p>\n

help<\/strong><\/span><\/div>\n

\u4e0a\u9762\u63d0\u5230\u4e86 \"builtin command\" \u4e5f\u5c31\u662f\u5185\u7f6e\u547d\u4ee4\uff0c\u5c31\u662f\u7531 shell \u63d0\u4f9b\u7684\u4e00\u4e9b\u57fa\u672c\u7684\u6216\u8005\u65e0\u6cd5\u7531\u5916\u90e8\u7a0b\u5e8f\u505a\u5230\u7684\u547d\u4ee4\u3002\u5e73\u5e38\u4f60\u53ef\u4ee5\u7528 man \u6765\u67e5\u770b\u6587\u6863\uff0c\u4f46\u662f\u5bf9\u4e8e\u5185\u7f6e\u547d\u4ee4 man \u4f1a\u8df3\u5230 shell \u81ea\u5df1\u7684 manpage\uff0c\u5728\u67d0\u4e9b\u7cfb\u7edf\u91cc\u90a3\u5c31\u662f\u5de8\u5927\u7684\u4e00\u9875\u4f60\u8981\u518d\u91cc\u9762\u627e\u5230\u4f60\u60f3\u770b\u7684\u4e1c\u897f\uff0c\u6709\u4e9b\u7cfb\u7edf\u91cc\u5e72\u8106\u5c31\u6ca1\u6709\u76f8\u5173\u7684\u4fe1\u606f\u3002\u8fd9\u79cd\u65f6\u5019\u7528 help \u8fd9\u4e2a\u5185\u7f6e\u547d\u4ee4\u5c31\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff1a\u6bd4\u5982\u8981\u67e5\u770b set \u7684\u63a5\u53d7\u7684\u9009\u9879\uff0c\u53ef\u4ee5\u7528 help set \u6765\u8f7b\u677e\u627e\u5230\u3002<\/p>\n

env<\/strong><\/span><\/div>\n

\u4f60\u5e94\u8be5\u77e5\u9053\u5728 #! (shebang) \u5728\u811a\u672c\u7b2c\u4e00\u884c\u7684\u4f5c\u7528\u662f\u6307\u5b9a\u5176 'runtime'\u3002\u6bd4\u5982\u8bf4\u4f60\u60f3\u8981\u5199\u4e00\u4e2a Python \u7684\u811a\u672c\uff0c\u4f46\u5176\u5b9e\u4e0d\u592a\u5728\u610f\u5176\u7248\u672c\uff0c\u6216\u8005\u4e0d\u786e\u5b9a\u5176\u53ef\u6267\u884c\u6587\u4ef6\u5728\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u5230\u5e95\u5728\u54ea\u91cc\u3002\u90a3\u4e48 env \u5728\u8fd9\u91cc\u5c31\u53ef\u4ee5\u6d3e\u4e0a\u7528\u573a\u4e86\u3002\u53ef\u4ee5\u5199\u6210 #!\/usr\/bin\/env python\uff0c\u8fd9\u6837\u6267\u884c\u7684\u65f6\u5019\u5c31\u4f1a\u7528\u5f53\u524d PATH \u4e2d\u627e\u5230\u7684 python\u3002\u53e6\u4e00\u65b9\u9762\u8fd9\u4e2a\u4e5f\u662f\u4e00\u4e2a\u7ed9\u4f60\u4e00\u4e2a\u5728\u4e0d\u4fee\u6539\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\uff0c\u91cd\u65b0\u9009\u62e9 'runtime' \u7684\u673a\u4f1a\u3002<\/p>\n

file<\/strong><\/span><\/div>\n

\u5982\u679c\u4f60\u60f3\u77e5\u9053\u67d0\u4e2a\u8def\u5f84\u4e0a\u7684\u6587\u4ef6\u5230\u5e95\u662f\u4ec0\u4e48\u7c7b\u578b\u7684\uff0c\u90a3\u4e48\u7528 file \u662f\u518d\u5408\u9002\u4e0d\u8fc7\u7684\u4e86\u3002\u5b83\u80fd\u5bf9\u4efb\u4f55\u4e1c\u897f\u90fd\u7ed9\u51fa\u4e00\u4e2a\u6709\u610f\u4e49\u7684\u89e3\u91ca\uff0c\u5bf9\u4e8e\u4e8c\u8fdb\u5236\u6587\u4ef6\u8fd8\u4f1a\u5217\u51fa\u5f88\u591a\u76f8\u5173\u7684\u91cd\u8981\u4fe1\u606f\u3002<\/p>\n

strings<\/strong><\/span><\/div>\n

\u201c\u6211\u628a\u6211\u7684\u79d8\u5bc6\uff0c\u653e\u5728\u4e86\u8fd9\u4e2a\u7528 C++ \u7f16\u5199\u7684\u7a0b\u5e8f\u91cc\u9762\u3002\u8fd0\u884c\u5b83\u8f93\u5165\u6b63\u786e\u7684\u5bc6\u7801\u624d\u80fd\u770b\u5230\u201d\u3002\u5176\u5b9e\u4e07\u4e00\u9047\u5230\u8fd9\u79cd\u60c5\u51b5\u4f60\u53ea\u8981\u8dd1 strings program-written-in-cxx \u5341\u6709\u516b\u4e5d\u4f60\u5c31\u80fd\u770b\u5230\u4e86\u3002\u5b83\u80fd\u6bd4\u8f83\u51c6\u786e\u7684\u5217\u51fa\u4e8c\u8fdb\u5236\u6587\u4ef6\u91cc\u5305\u542b\u7684 C \u98ce\u683c\u7684\u5b57\u7b26\u4e32\u3002\u770b\u8d77\u6765\u6ca1\u4ec0\u4e48\u610f\u4e49\u4f46\u662f\u5176\u5b9e\u4f5c\u7528\u5b8c\u5168\u8981\u9760\u4f60\u53d1\u6325\uff0c\u6bd4\u5982\u8981\u77e5\u9053\u67d0\u4e2a\u7a0b\u5e8f\u662f\u54ea\u4e2a\u7248\u672c GCC \u7f16\u8bd1\u51fa\u6765\u7684\u7528 strings \u53ef\u80fd\u6709\u7ed3\u679c\u3002<\/p>\n

od<\/strong><\/span><\/div>\n

\u5168\u7a0b\u5e94\u8be5\u662f \"object dump\"\uff0c\u53ef\u4ee5\u5c06\u6587\u4ef6\u6309\u516b\u8fdb\u5236\uff0c\u5341\u516d\u8fdb\u5236\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u663e\u793a\u51fa\u6765\u3002\u6211\u89c9\u5f97\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u8fd9\u5927\u5bb6\u90fd\u5728\u7528 od -c\uff0c\u5c06\u6587\u4ef6\u6309 ASCII \u7801 dump \u51fa\u6765\u3002\u4e00\u4e2a\u7528\u4f8b\u662f\u7528\u6765\u770b\u6587\u4ef6\u7684 line ending \u5230\u5e95\u662f\u600e\u6837\u7684\u3002\u6bd4\u5982\u6267\u884c od -c foo.txt \u663e\u793a\u5982\u4e0b\u7ed3\u679c\uff1a<\/p>\n

$ od -c foo.txt\r\n0000000<\/span>   h   e   l   l   o  \\t   w   o   r   l   d  \\r  \\n   y   e   a\r\n0000020<\/span>   h\r\n0000021<\/span>\r\n<\/pre>\n

\u53ef\u4ee5\u6e05\u695a\u7684\u770b\u5230 \\t \u662f tab \u5b57\u7b26\uff0c \\r\\n \u662f Windows \u98ce\u683c\u7684\u6362\u884c\u7b26\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.jianshu.com\/p\/5ca890e5bdbf<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/linux-noticed-cmd.html\u00a0<\/a>\u7f16\u8f91\uff1a\u6731\u57f9\u68cb\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u7bc7\u6587\u7ae0\u4ec5\u8ba8\u8bba Linux \u73af\u5883\u4e0b\u7684\u4e1c\u897f\uff0c\u5f88\u663e\u7136\u5bf9 MacOS \u4e5f\u9002\u7528\u3002\u5176\u5b9e\u5f88\u591a\u4e1c\u897f\u867d\u7136\u6709 Windows \u4e5f […]<\/p>\n","protected":false},"author":63,"featured_media":116959,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-116080","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\/116080","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=116080"}],"version-history":[{"count":12,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/116080\/revisions"}],"predecessor-version":[{"id":117049,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/116080\/revisions\/117049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/116959"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=116080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=116080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=116080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}