{"id":282058,"date":"2023-09-07T20:07:55","date_gmt":"2023-09-07T12:07:55","guid":{"rendered":"https:\/\/gulass.cn\/lzmtccgjmjqr.html"},"modified":"2023-09-07T20:07:55","modified_gmt":"2023-09-07T12:07:55","slug":"lzmtccgjmjqr","status":"publish","type":"post","link":"https:\/\/gulass.cn\/lzmtccgjmjqr.html","title":{"rendered":"linux\u600e\u4e48\u9000\u51facat 8\u4e2a\u7edd\u5999\u6280\u5de7\uff0c\u8ba9\u4f60\u6210\u4e3a\u771f\u6b63\u7684Linux\u5927\u5e08\uff01"},"content":{"rendered":"

\u5728Linux<\/a>\u7684\u4e16\u754c\u91cc\uff0ccat\uff08concatenate\uff09\u547d\u4ee4<\/a>\u662f\u4e00\u628a\u5229\u5251\uff0c\u53ef\u4ee5\u65e0\u7f1d\u8fde\u63a5\u6587\u4ef6\u5185\u5bb9linux\u5b9a\u65f6\u5668\uff0c\u540c\u65f6\u4e5f\u662f\u4e00\u4e2a\u8ff7\u5bab\uff0c\u8ba9\u4eba\u56f0\u60d1\u4e0d\u89e3\u3002\u4f46\u662f\uff0c\u4f60\u53ef\u66fe\u60f3\u8fc7\uff0ccat\u547d\u4ee4\u8fd8\u6709\u4e00\u4e2a\u9690\u85cf\u7684\u529f\u80fd\u2014\u2014\u9000\u51fa\uff1f\u662f\u7684\uff0c\u4f60\u6ca1\u6709\u542c\u9519\uff01\u672c\u6587\u5c06\u4e3a\u4f60\u63ed\u5f00\u8fd9\u4e2a\u795e\u79d8\u9762\u7eb1\uff0c\u5e76\u5206\u4eab8\u4e2a\u7edd\u5999\u6280\u5de7\uff0c\u8ba9\u4f60\u6210\u4e3a\u771f\u6b63\u7684Linux\u5927\u5e08\uff01<\/p>\n

1. Ctrl +C\uff1a\u7b80\u5355\u7c97\u66b4<\/b><\/p>\n

\u4f5c\u4e3a\u4e00\u4e2aLinux\u5c0f\u767d\uff0c\u4f60\u53ef\u80fd\u4f1a\u95ee\uff1a\u201c\u600e\u4e48\u9000\u51facat\u547d\u4ee4\u5462\uff1f\u201d\u5176\u5b9elinux\u600e\u4e48\u9000\u51facat<\/strong>\uff0c\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u5c31\u662f\u4f7f\u7528\u7ec4\u5408\u952eCtrl +C\u3002\u5f53\u4f60\u8f93\u5165\u4e86cat\u547d\u4ee4\u540e\uff0c\u5982\u679c\u53d1\u73b0\u8fdb\u5165\u4e86\u4e00\u4e2a\u65e0\u5c3d\u7684\u6587\u4ef6\u5185\u5bb9\u8f93\u51fa\u754c\u9762\uff0c\u522b\u614c\u5f20\uff01\u6309\u4e0bCtrl +C\u7ec4\u5408\u952e\u5373\u53ef\u7acb\u5373\u505c\u6b62\u8f93\u51fa\uff0c\u5e76\u56de\u5230\u7ec8\u7aef\u547d\u4ee4\u884c\u63d0\u793a\u7b26\u3002<\/p>\n

2.Q\u952e\uff1a\u5feb\u901f\u7ed3\u675f<\/b><\/p>\n

linux\u547d\u4ee4vi\u7684\u9000\u51fa\u67e5\u770b_linux\u600e\u4e48\u9000\u51facat_linux\u547d\u4ee4cat\u4f7f\u7528\u7b80\u4ecb<\/p>\n

\u9664\u4e86Ctrl +C\u4e4b\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u66f4\u52a0\u5feb\u901f\u7684\u65b9\u5f0f\u53ef\u4ee5\u9000\u51facat\u547d\u4ee4\u2014\u2014\u6309\u4e0bQ\u952e\u3002\u5f53\u4f60\u6b63\u5728\u6d4f\u89c8\u6587\u4ef6\u5185\u5bb9\u65f6\uff0c\u53ea\u9700\u6309\u4e0bQ\u952e\u5373\u53ef\u7acb\u5373\u9000\u51fa\uff0c\u5e76\u56de\u5230\u7ec8\u7aef\u547d\u4ee4\u884c\u754c\u9762\u3002\u8fd9\u4e2a\u5c0f\u6280\u5de7\u975e\u5e38\u5b9e\u7528\uff0c\u5728\u5904\u7406\u5927\u578b\u6587\u4ef6\u65f6\u5c24\u5176\u6709\u6548\u3002<\/p>\n

3.\u7ba1\u9053\u7b26\u53f7\uff1a\u6253\u7834\u5faa\u73af<\/b><\/p>\n

\u6709\u65f6\u5019\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\uff0c\u6bd4\u5982\u4f7f\u7528cat\u547d\u4ee4\u67e5\u770b\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u7ed3\u679c\u53d1\u73b0\u81ea\u5df1\u9677\u5165\u4e86\u65e0\u5c3d\u7684\u5faa\u73af\u8f93\u51fa\u4e2d\u3002\u8fd9\u65f6\uff0c\u4f60\u53ef\u4ee5\u5229\u7528\u7ba1\u9053\u7b26\u53f7\uff08|\uff09\u7ed3\u5408\u5176\u4ed6\u547d\u4ee4\u6765\u6253\u7834\u5faa\u73af\uff0c\u4f8b\u5982\uff1a<\/p>\n

\n

\ncat logfile | head -n 10\n<\/pre>\n<\/p>\n

\u8fd9\u4e2a\u547d\u4ee4\u5c06\u53ea\u663e\u793a\u6587\u4ef6\u7684\u524d10\u884c\u5185\u5bb9\uff0c\u800c\u4e0d\u4f1a\u7ee7\u7eed\u8f93\u51fa\u5269\u4f59\u5185\u5bb9\u3002<\/p>\n

4. less\u547d\u4ee4\uff1a\u638c\u63a7\u5168\u5c40<\/b><\/p>\n

\u5982\u679c\u4f60\u7ecf\u5e38\u9700\u8981\u67e5\u770b\u5927\u578b\u6587\u4ef6\uff0c\u5e76\u4e14\u5e0c\u671b\u80fd\u591f\u7075\u6d3b\u5730\u6d4f\u89c8\u548c\u641c\u7d22\u6587\u4ef6\u5185\u5bb9\uff0c\u90a3\u4e48less\u547d\u4ee4\u5c06\u6210\u4e3a\u4f60\u7684\u5f97\u529b\u52a9\u624b\u3002\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u7528less\u547d\u4ee4\uff1a<\/p>\n

\n

\nless filename\n<\/pre>\n<\/p>\n

linux\u547d\u4ee4cat\u4f7f\u7528\u7b80\u4ecb_linux\u547d\u4ee4vi\u7684\u9000\u51fa\u67e5\u770b_linux\u600e\u4e48\u9000\u51facat<\/p>\n

\u5728less\u754c\u9762\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u7a7a\u683c\u952e\u5411\u4e0b\u6eda\u52a8\u4e00\u9875\uff0c\u4f7f\u7528b\u952e\u5411\u4e0a\u6eda\u52a8\u4e00\u9875\uff0c\u4f7f\u7528\/\u952e\u8fdb\u884c\u5185\u5bb9\u641c\u7d22\u7b49\u64cd\u4f5c\u3002\u5f53\u4f60\u60f3\u8981\u9000\u51fa\u65f6\uff0c\u53ea\u9700\u6309\u4e0bq\u952e\u5373\u53ef\u3002<\/p>\n

5. Ctrl +D\uff1a\u4f18\u96c5\u79bb\u573a<\/b><\/p>\n

\u9664\u4e86\u5728cat\u547d\u4ee4\u4e2d\u9000\u51fa\u4e4b\u5916\uff0c\u6709\u65f6\u5019\u6211\u4eec\u8fd8\u9700\u8981\u5728\u5176\u4ed6\u4ea4\u4e92\u5f0f\u7a0b\u5e8f\u4e2d\u9000\u51fa\u3002\u6b64\u65f6\uff0c\u7ec4\u5408\u952eCtrl +D\u5c06\u662f\u4f60\u7684\u6551\u661f\u3002\u5f53\u4f60\u8f93\u5165Ctrl +D\u65f6\uff0c\u7cfb\u7edf<\/a>\u4f1a\u7acb\u5373\u53d1\u9001\u4e00\u4e2aEOF\uff08End of File\uff09\u4fe1\u53f7\u7ed9\u7a0b\u5e8flinux\u600e\u4e48\u9000\u51facat<\/strong>\uff0c\u7a0b\u5e8f\u4f1a\u7406\u89e3\u4e3a\u6587\u4ef6\u5df2\u7ed3\u675f\uff0c\u5e76\u4e14\u9000\u51fa\u3002<\/p>\n

6. Ctrl +Z\uff1a\u6682\u505c\u5e76\u540e\u53f0\u8fd0\u884c<\/b><\/p>\n

\u6709\u65f6\u5019\uff0c\u4f60\u53ef\u80fd\u4f1a\u5e0c\u671b\u6682\u505c\u6b63\u5728\u8fd0\u884c\u7684cat\u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u653e\u5230\u540e\u53f0\u6267\u884c\u3002\u8fd9\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u7ec4\u5408\u952eCtrl +Z\u3002\u5b83\u4f1a\u5c06\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u547d\u4ee4\u6302\u8d77\uff0c\u5e76\u8fd4\u56de\u5230\u7ec8\u7aef\u547d\u4ee4\u884c\u754c\u9762\u3002\u8981\u6062\u590d\u6302\u8d77\u7684\u547d\u4ee4\uff0c\u53ea\u9700\u8f93\u5165\u547d\u4ee4`fg`\u5373\u53ef\u3002<\/p>\n

7. kill\u547d\u4ee4\uff1a\u7ec8\u7ed3\u4e00\u5207<\/b><\/p>\n

\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u4f60\u65e0\u6cd5\u901a\u8fc7\u6b63\u5e38\u7684\u65b9\u5f0f\u9000\u51facat\u547d\u4ee4\uff0c\u6216\u8005\u7a0b\u5e8f\u65e0\u54cd\u5e94\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u4f7f\u7528kill\u547d\u4ee4\u6765\u7ec8\u6b62\u8be5\u8fdb\u7a0b\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981\u627e\u5230cat\u547d\u4ee4\u6240\u5728\u7684\u8fdb\u7a0bID\uff08PID\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528`ps aux | grep cat`\u547d\u4ee4\u6765\u67e5\u627e\u3002\u7136\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u7ec8\u6b62\u8fdb\u7a0b\uff1a<\/p>\n

\n

\nkill -9 PID\n<\/pre>\n<\/p>\n

linux\u547d\u4ee4vi\u7684\u9000\u51fa\u67e5\u770b_linux\u600e\u4e48\u9000\u51facat_linux\u547d\u4ee4cat\u4f7f\u7528\u7b80\u4ecb<\/p>\n

\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u53d1\u9001\u4e00\u4e2a\u5f3a\u5236\u7ec8\u6b62\u4fe1\u53f7\u7ed9\u6307\u5b9a\u7684\u8fdb\u7a0b\uff0c\u786e\u4fdd\u5176\u7acb\u5373\u9000\u51fa\u3002<\/p>\n

8. man\u9875\uff1a\u5b66\u65e0\u6b62\u5883<\/b><\/p>\n

\u4f5c\u4e3a\u4e00\u540dLinux\u7231\u597d\u8005\uff0c\u4f60\u5e94\u8be5\u719f\u6089man\u9875\uff08manual page\uff09\u7684\u5b58\u5728\u3002man\u9875\u63d0\u4f9b\u4e86\u5173\u4e8e\u6240\u6709Linux\u547d\u4ee4\u548c\u51fd\u6570\u7684\u8be6\u7ec6\u6587\u6863\u548c\u7528\u6cd5\u8bf4\u660e\u3002\u5f53\u4f60\u9047\u5230\u4efb\u4f55\u56f0\u60d1\u65f6\uff0c\u53ea\u9700\u8f93\u5165`man cat`\u5373\u53ef\u67e5\u770b\u6709\u5173cat\u547d\u4ee4\u7684\u5b8c\u6574\u6587\u6863\u3002\u5728man\u9875\u4e2d\uff0c\u4f60\u5c06\u627e\u5230\u66f4\u591a\u5173\u4e8ecat\u547d\u4ee4\u7684\u9000\u51fa\u65b9\u6cd5\u4ee5\u53ca\u5176\u4ed6\u9ad8\u7ea7\u6280\u5de7\u3002<\/p>\n

Linux\u4e16\u754c\u4e2d\u7684cat\u547d\u4ee4\uff0c\u7edd\u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u4ef6\u5185\u5bb9\u67e5\u770b\u5668\u3002\u638c\u63e1\u4e86\u8fd9\u4e9b\u9000\u51fa\u6280\u5de7\uff0c\u4f60\u5c06\u80fd\u591f\u66f4\u52a0\u81ea\u5982\u5730\u4f7f\u7528cat\u547d\u4ee4linux\u5b89\u88c5\uff0c\u5e76\u5728Linux\u7684\u4e16\u754c\u4e2d\u6e38\u5203\u6709\u4f59\u3002\u76f8\u4fe1\u901a\u8fc7\u672c\u6587\u7684\u6307\u5bfc\uff0c\u4f60\u5df2\u7ecf\u6210\u4e3a\u4e86\u4e00\u4e2a\u771f\u6b63\u7684Linux\u5927\u5e08\uff01\u5feb\u53bb\u5c1d\u8bd5\u5427\uff0c\u5c0f\u4f19\u4f34\u4eec\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u5c06\u4e3a\u4f60\u63ed\u5f00\u8fd9\u4e2a\u795e\u79d8\u9762\u7eb1\uff0c\u5e76\u5206\u4eab8\u4e2a\u7edd\u5999\u6280\u5de7\uff0c\u8ba9\u4f60\u6210\u4e3a\u771f\u6b63\u7684Linux\u5927\u5e08\uff01\u9664\u4e86\u5728cat\u547d\u4ee4\u4e2d\u9000\u51fa\u4e4b\u5916\uff0c\u6709\u65f6\u5019\u6211\u4eec\u8fd8\u9700\u8981\u5728\u5176\u4ed6\u4ea4\u4e92\u5f0f\u7a0b\u5e8f\u4e2d\u9000\u51fa\u3002\u5728man\u9875\u4e2d\uff0c\u4f60\u5c06\u627e\u5230\u66f4\u591a\u5173\u4e8ecat\u547d\u4ee4\u7684\u9000\u51fa\u65b9\u6cd5\u4ee5\u53ca\u5176\u4ed6\u9ad8\u7ea7\u6280\u5de7\u3002\u638c\u63e1\u4e86\u8fd9\u4e9b\u9000\u51fa\u6280\u5de7\uff0c\u4f60\u5c06\u80fd\u591f\u66f4\u52a0\u81ea\u5982\u5730\u4f7f\u7528cat\u547d\u4ee4\uff0c\u5e76\u5728Linux\u7684\u4e16\u754c\u4e2d\u6e38\u5203\u6709\u4f59\u3002\u76f8\u4fe1\u901a\u8fc7\u672c\u6587\u7684\u6307\u5bfc\uff0c\u4f60\u5df2\u7ecf\u6210\u4e3a\u4e86\u4e00\u4e2a\u771f\u6b63\u7684Linux\u5927\u5e08\uff01<\/p>\n","protected":false},"author":1,"featured_media":282059,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-282058","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/282058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=282058"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/282058\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/282059"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=282058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=282058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=282058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}