{"id":63909,"date":"2025-04-29T15:40:47","date_gmt":"2025-04-29T07:40:47","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63909\/"},"modified":"2025-04-29T15:40:47","modified_gmt":"2025-04-29T07:40:47","slug":"linux%e6%9f%a5%e7%9c%8b%e8%bf%9b%e7%a8%8b%e5%b1%9e%e4%ba%8e%e5%93%aa%e4%b8%aa%e7%a8%8b%e5%ba%8f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63909\/","title":{"rendered":"linux\u67e5\u770b\u8fdb\u7a0b\u5c5e\u4e8e\u54ea\u4e2a\u7a0b\u5e8f"},"content":{"rendered":"<blockquote><p>\n  \u8981\u67e5\u770b linux \u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u4f7f\u7528 ps -f \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u7684 cmd \u5217\uff1b\u4f7f\u7528 pstree -a \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u6811\u4e2d\u7684\u62ec\u53f7\u5185\u7684\u7a0b\u5e8f\u540d\uff1b\u4f7f\u7528 top \u547d\u4ee4\u6309 c \u952e\u67e5\u770b command \u5217\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081719043132274.jpg\" class=\"aligncenter\" title=\"linux\u67e5\u770b\u8fdb\u7a0b\u5c5e\u4e8e\u54ea\u4e2a\u7a0b\u5e8f\u63d2\u56fe\" alt=\"linux\u67e5\u770b\u8fdb\u7a0b\u5c5e\u4e8e\u54ea\u4e2a\u7a0b\u5e8f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Linux \u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f<\/strong><\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u8fdb\u7a0b\u662f\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u5b9e\u4f8b\u3002\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u5c5e\u4e8e\u4e00\u4e2a\u7279\u5b9a\u7684\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u6765\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff1a<\/p>\n<p><strong>1. ps \u547d\u4ee4<\/strong><\/p>\n<p>ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u5217\u8868\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528 -f \u9009\u9879\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>ps -f<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u5c06\u5305\u62ec\u4ee5\u4e0b\u5217\uff1a<\/p>\n<ul>\n<li> <strong>PID\uff1a<\/strong> \u8fdb\u7a0b ID<\/li>\n<li> <strong>USER\uff1a<\/strong> \u8fd0\u884c\u8fdb\u7a0b\u7684\u7528\u6237<\/li>\n<li> <strong>%CPU\uff1a<\/strong> \u8fdb\u7a0b\u4f7f\u7528\u7684 CPU \u767e\u5206\u6bd4<\/li>\n<li> <strong>%MEM\uff1a<\/strong> \u8fdb\u7a0b\u4f7f\u7528\u7684\u5185\u5b58\u767e\u5206\u6bd4<\/li>\n<li> <strong>VSZ\uff1a<\/strong> \u8fdb\u7a0b\u7684\u865a\u62df\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>RSS\uff1a<\/strong> \u8fdb\u7a0b\u7684\u5e38\u9a7b\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>TTY\uff1a<\/strong> \u8fdb\u7a0b\u8fde\u63a5\u7684\u7ec8\u7aef<\/li>\n<li> <strong>STAT\uff1a<\/strong> \u8fdb\u7a0b\u7684\u72b6\u6001<\/li>\n<li> <strong>START\uff1a<\/strong> \u8fdb\u7a0b\u542f\u52a8\u7684\u65f6\u95f4<\/li>\n<li> <strong>TIME\uff1a<\/strong> \u8fdb\u7a0b\u8fd0\u884c\u7684\u65f6\u95f4<\/li>\n<li> <strong>CMD\uff1a<\/strong> \u8fdb\u7a0b\u547d\u4ee4<\/li>\n<\/ul>\n<p>CMD \u5217\u663e\u793a\u4e86\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\u3002<\/p>\n<p><strong>2. pstree \u547d\u4ee4<\/strong><\/p>\n<p>pstree \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u8fdb\u7a0b\u7684\u6811\u72b6\u7ed3\u6784\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528 -a \u9009\u9879\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>pstree -a<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u5c06\u663e\u793a\u4e00\u4e2a\u6811\u5f62\u7ed3\u6784\uff0c\u5176\u4e2d\u6bcf\u4e2a\u8fdb\u7a0b\u663e\u793a\u5728\u5176\u7236\u8fdb\u7a0b\u4e0b\u65b9\u3002\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\u663e\u793a\u5728\u8fdb\u7a0b\u540d\u7684\u62ec\u53f7\u4e2d\u3002<\/p>\n<p><strong>3. top \u547d\u4ee4<\/strong><\/p>\n<p>top \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7684\u5b9e\u65f6\u4fe1\u606f\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528 c \u952e\u3002<\/p>\n<p>\u6309 c \u952e\u540e\uff0c\u8f93\u51fa\u5c06\u5305\u62ec\u4ee5\u4e0b\u5217\uff1a<\/p>\n<ul>\n<li> <strong>PID\uff1a<\/strong> \u8fdb\u7a0b ID<\/li>\n<li> <strong>USER\uff1a<\/strong> \u8fd0\u884c\u8fdb\u7a0b\u7684\u7528\u6237<\/li>\n<li> <strong>PR\uff1a<\/strong> \u8fdb\u7a0b\u4f18\u5148\u7ea7<\/li>\n<li> <strong>NI\uff1a<\/strong> \u8fdb\u7a0b\u4e0d\u9519\u503c<\/li>\n<li> <strong>VIRT\uff1a<\/strong> \u8fdb\u7a0b\u7684\u865a\u62df\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>RES\uff1a<\/strong> \u8fdb\u7a0b\u7684\u5e38\u9a7b\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>SHR\uff1a<\/strong> \u8fdb\u7a0b\u7684\u5171\u4eab\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>S\uff1a<\/strong> \u8fdb\u7a0b\u7684\u72b6\u6001<\/li>\n<li> <strong>%CPU\uff1a<\/strong> \u8fdb\u7a0b\u4f7f\u7528\u7684 CPU \u767e\u5206\u6bd4<\/li>\n<li> <strong>%MEM\uff1a<\/strong> \u8fdb\u7a0b\u4f7f\u7528\u7684\u5185\u5b58\u767e\u5206\u6bd4<\/li>\n<li> <strong>TIME+\uff1a<\/strong> \u8fdb\u7a0b\u8fd0\u884c\u7684\u65f6\u95f4<\/li>\n<li> <strong>COMMAND\uff1a<\/strong> \u8fdb\u7a0b\u547d\u4ee4<\/li>\n<\/ul>\n<p>COMMAND \u5217\u663e\u793a\u4e86\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b\u8fdb\u7a0b\u5c5e\u4e8e\u54ea\u4e2a\u7a0b\u5e8f\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>\u8981\u67e5\u770b linux \u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u4f7f\u7528 ps -f \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u7684 cmd \u5217\uff1b\u4f7f\u7528 pstree -a \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u6811\u4e2d\u7684\u62ec\u53f7\u5185\u7684\u7a0b\u5e8f\u540d\uff1b\u4f7f\u7528 top \u547d\u4ee4\u6309 c \u952e\u67e5\u770b command \u5217\u3002 \u5982\u4f55\u67e5\u770b Linux \u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u8fdb\u7a0b\u662f\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u5b9e\u4f8b\u3002\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u5c5e\u4e8e\u4e00\u4e2a\u7279\u5b9a\u7684\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u6765\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff1a 1. ps \u547d\u4ee4 ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u5217\u8868\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u6240\u5c5e\u7684\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528 -f \u9009\u9879\u3002\u4f8b\u5982\uff1a ps -f \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u5c06\u5305\u62ec\u4ee5\u4e0b\u5217\uff1a PID\uff1a \u8fdb\u7a0b ID USER\uff1a \u8fd0\u884c\u8fdb\u7a0b\u7684\u7528\u6237 %CPU\uff1a \u8fdb\u7a0b\u4f7f\u7528\u7684 CPU \u767e\u5206\u6bd4 %MEM\uff1a \u8fdb\u7a0b\u4f7f\u7528\u7684\u5185\u5b58\u767e\u5206\u6bd4 VSZ\uff1a \u8fdb\u7a0b\u7684\u865a\u62df\u5185\u5b58\u5927\u5c0f RSS\uff1a \u8fdb\u7a0b\u7684\u5e38\u9a7b\u5185\u5b58\u5927\u5c0f TTY\uff1a \u8fdb\u7a0b\u8fde\u63a5\u7684\u7ec8\u7aef STAT\uff1a \u8fdb\u7a0b\u7684\u72b6\u6001 START\uff1a \u8fdb\u7a0b\u542f\u52a8\u7684\u65f6\u95f4 [&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-63909","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63909","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=63909"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63909\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}