{"id":63912,"date":"2025-04-29T14:52:59","date_gmt":"2025-04-29T06:52:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63912\/"},"modified":"2025-04-29T14:52:59","modified_gmt":"2025-04-29T06:52:59","slug":"linux%e6%9f%a5%e7%9c%8b%e8%bf%9b%e7%a8%8b%e7%9a%84%e5%91%bd%e4%bb%a4-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63912\/","title":{"rendered":"linux\u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4"},"content":{"rendered":"<blockquote><p>\n  \u5728 linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u8fdb\u7a0b\u6700\u5e38\u7528\u7684\u547d\u4ee4\u662f ps\uff0c\u5176\u6807\u5fd7\u5305\u62ec\uff1aps aux\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606fps -ef\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u6269\u5c55\u4fe1\u606fps -u\uff1a\u663e\u793a\u6307\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0btop\uff1a\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u6d3b\u52a8pidstat\uff1a\u663e\u793a\u6307\u5b9a\u8fdb\u7a0b\u7684\u7edf\u8ba1\u4fe1\u606fpstree\uff1a\u4ee5\u6811\u72b6\u7ed3\u6784\u663e\u793a\u8fdb\u7a0b\u5173\u7cfbstrace\uff1a\u8ddf\u8e2a\u8fdb\u7a0b\u7684\u7cfb\u7edf\u8c03\u7528\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081719074060468.jpg\" class=\"aligncenter\" title=\"linux\u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4\u63d2\u56fe\" alt=\"linux\u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4\u63d2\u56fe\" \/><\/p>\n<p><strong>Linux \u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4<\/strong><\/p>\n<p><strong>\u5f15\u8a00<\/strong><\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u7ba1\u7406\u548c\u76d1\u89c6\u8fdb\u7a0b\u662f\u7cfb\u7edf\u7ba1\u7406\u5458\u5fc5\u5907\u7684\u57fa\u672c\u6280\u80fd\u3002\u6709\u5f88\u591a\u547d\u4ee4\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u8fdb\u7a0b\uff0c\u6bcf\u4e2a\u547d\u4ee4\u90fd\u63d0\u4f9b\u4e0d\u540c\u7ea7\u522b\u7684\u6570\u636e\u548c\u7ec6\u8282\u3002<\/p>\n<p><strong>\u67e5\u770b\u6240\u6709\u8fdb\u7a0b<\/strong><\/p>\n<p>\u6700\u5e38\u7528\u7684\u547d\u4ee4\u662f ps\uff0c\u5b83\u663e\u793a\u5f53\u524d\u8fd0\u884c\u7684\u6240\u6709\u8fdb\u7a0b\u3002<\/p>\n<ul>\n<li> <strong>ps aux<\/strong>\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff0c\u5305\u62ec\u7528\u6237\u3001\u8fdb\u7a0b ID\uff08PID\uff09\u3001\u7236\u8fdb\u7a0b ID\uff08PPID\uff09\u3001CPU \u548c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/li>\n<li> <strong>ps -ef<\/strong>\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u6269\u5c55\u4fe1\u606f\uff0c\u5305\u62ec\u547d\u4ee4\u884c\u53c2\u6570\u3002<\/li>\n<\/ul>\n<p><strong>\u8fc7\u6ee4\u8f93\u51fa<\/strong><\/p>\n<p>\u8981\u8fc7\u6ee4 ps \u8f93\u51fa\uff0c\u53ef\u4ee5\u4f7f\u7528\u5404\u79cd\u6807\u5fd7\uff1a<\/p>\n<ul>\n<li> <strong>ps -u username<\/strong>\uff1a\u663e\u793a\u6307\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>ps -p pid<\/strong>\uff1a\u4ec5\u663e\u793a\u6307\u5b9a PID \u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>ps &#8211;sort=column<\/strong>\uff1a\u6309\u7279\u5b9a\u5217\uff08\u5982 CPU \u6216 MEM\uff09\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<p><strong>\u67e5\u770b\u5177\u4f53\u8fdb\u7a0b<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u7279\u5b9a\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li> <strong>top<\/strong>\uff1a\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u6d3b\u52a8\uff0c\u5305\u62ec\u8fdb\u7a0b\u4fe1\u606f\u3002<\/li>\n<li> <strong>htop<\/strong>\uff1a\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u8fdb\u7a0b\u67e5\u770b\u5668\uff0c\u63d0\u4f9b\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f\u3002<\/li>\n<li> <strong>pidstat pid<\/strong>\uff1a\u663e\u793a\u6307\u5b9a PID \u8fdb\u7a0b\u7684 CPU\u3001\u5185\u5b58\u548c I\/O \u7edf\u8ba1\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><strong>\u67e5\u770b\u8fdb\u7a0b\u95f4\u5173\u7cfb<\/strong><\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u8fdb\u7a0b\u4e4b\u95f4\u7684\u5173\u7cfb\uff1a<\/p>\n<ul>\n<li> <strong>pstree<\/strong>\uff1a\u4ee5\u6811\u72b6\u7ed3\u6784\u663e\u793a\u8fdb\u7a0b\u53ca\u5176\u5b50\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>strace pid<\/strong>\uff1a\u8ddf\u8e2a\u6307\u5b9a PID \u8fdb\u7a0b\u7684\u7cfb\u7edf\u8c03\u7528\u3002<\/li>\n<li> <strong>lsof<\/strong>\uff1a\u663e\u793a\u6307\u5b9a\u8fdb\u7a0b\u6253\u5f00\u7684\u6587\u4ef6\u548c\u7f51\u7edc\u8fde\u63a5\u3002<\/li>\n<\/ul>\n<p><strong>\u5176\u4ed6\u6709\u7528\u547d\u4ee4<\/strong><\/p>\n<ul>\n<li> <strong>kill pid<\/strong>\uff1a\u7ec8\u6b62\u6307\u5b9a PID \u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>killall name<\/strong>\uff1a\u7ec8\u6b62\u6240\u6709\u5177\u6709\u6307\u5b9a\u540d\u79f0\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>renice priority pid<\/strong>\uff1a\u66f4\u6539\u6307\u5b9a PID \u8fdb\u7a0b\u7684\u4f18\u5148\u7ea7\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u8fdb\u7a0b\u6700\u5e38\u7528\u7684\u547d\u4ee4\u662f ps\uff0c\u5176\u6807\u5fd7\u5305\u62ec\uff1aps aux\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606fps -ef\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u6269\u5c55\u4fe1\u606fps -u\uff1a\u663e\u793a\u6307\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0btop\uff1a\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u6d3b\u52a8pidstat\uff1a\u663e\u793a\u6307\u5b9a\u8fdb\u7a0b\u7684\u7edf\u8ba1\u4fe1\u606fpstree\uff1a\u4ee5\u6811\u72b6\u7ed3\u6784\u663e\u793a\u8fdb\u7a0b\u5173\u7cfbstrace\uff1a\u8ddf\u8e2a\u8fdb\u7a0b\u7684\u7cfb\u7edf\u8c03\u7528 Linux \u67e5\u770b\u8fdb\u7a0b\u7684\u547d\u4ee4 \u5f15\u8a00 \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u7ba1\u7406\u548c\u76d1\u89c6\u8fdb\u7a0b\u662f\u7cfb\u7edf\u7ba1\u7406\u5458\u5fc5\u5907\u7684\u57fa\u672c\u6280\u80fd\u3002\u6709\u5f88\u591a\u547d\u4ee4\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u8fdb\u7a0b\uff0c\u6bcf\u4e2a\u547d\u4ee4\u90fd\u63d0\u4f9b\u4e0d\u540c\u7ea7\u522b\u7684\u6570\u636e\u548c\u7ec6\u8282\u3002 \u67e5\u770b\u6240\u6709\u8fdb\u7a0b \u6700\u5e38\u7528\u7684\u547d\u4ee4\u662f ps\uff0c\u5b83\u663e\u793a\u5f53\u524d\u8fd0\u884c\u7684\u6240\u6709\u8fdb\u7a0b\u3002 ps aux\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff0c\u5305\u62ec\u7528\u6237\u3001\u8fdb\u7a0b ID\uff08PID\uff09\u3001\u7236\u8fdb\u7a0b ID\uff08PPID\uff09\u3001CPU \u548c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002 ps -ef\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u6269\u5c55\u4fe1\u606f\uff0c\u5305\u62ec\u547d\u4ee4\u884c\u53c2\u6570\u3002 \u8fc7\u6ee4\u8f93\u51fa \u8981\u8fc7\u6ee4 ps \u8f93\u51fa\uff0c\u53ef\u4ee5\u4f7f\u7528\u5404\u79cd\u6807\u5fd7\uff1a ps -u username\uff1a\u663e\u793a\u6307\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002 ps -p pid\uff1a\u4ec5\u663e\u793a\u6307\u5b9a PID \u7684\u8fdb\u7a0b\u3002 ps &#8211;sort=column\uff1a\u6309\u7279\u5b9a\u5217\uff08\u5982 CPU \u6216 MEM\uff09\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u6392\u5e8f\u3002 \u67e5\u770b\u5177\u4f53\u8fdb\u7a0b \u8981\u67e5\u770b\u7279\u5b9a\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a top\uff1a\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u6d3b\u52a8\uff0c\u5305\u62ec\u8fdb\u7a0b\u4fe1\u606f\u3002 htop\uff1a\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u8fdb\u7a0b\u67e5\u770b\u5668\uff0c\u63d0\u4f9b\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f\u3002 pidstat pid\uff1a\u663e\u793a\u6307\u5b9a PID \u8fdb\u7a0b\u7684 CPU\u3001\u5185\u5b58\u548c I\/O \u7edf\u8ba1\u4fe1\u606f\u3002 \u67e5\u770b\u8fdb\u7a0b\u95f4\u5173\u7cfb \u4ee5\u4e0b\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u8fdb\u7a0b\u4e4b\u95f4\u7684\u5173\u7cfb\uff1a pstree\uff1a\u4ee5\u6811\u72b6\u7ed3\u6784\u663e\u793a\u8fdb\u7a0b\u53ca\u5176\u5b50\u8fdb\u7a0b\u3002 strace [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63912","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63912"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63912\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}