{"id":18365,"date":"2024-11-18T13:08:01","date_gmt":"2024-11-18T05:08:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18365\/"},"modified":"2024-11-18T13:08:01","modified_gmt":"2024-11-18T05:08:01","slug":"linux%e6%9f%a5%e7%9c%8b%e5%bd%93%e5%89%8d%e8%bf%90%e8%a1%8c%e8%bf%9b%e7%a8%8b%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18365\/","title":{"rendered":"linux\u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u547d\u4ee4"},"content":{"rendered":"<blockquote><p>\n  linux \u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u547d\u4ee4\u4e3a psps\uff0c\u5b83\u53ef\u663e\u793a\u8fdb\u7a0b\u8be6\u7ec6\u4fe1\u606f\uff0c\u5982 pid\u3001\u7528\u6237\u3001\u547d\u4ee4\u548c cpu \u4f7f\u7528\u60c5\u51b5\u3002\u5e38\u7528\u9009\u9879\u5305\u62ec\uff1a-a\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b-u\uff1a\u663e\u793a\u7279\u5b9a\u7528\u6237\u7684\u8fdb\u7a0b\u4fe1\u606f-x\uff1a\u663e\u793a\u65e0\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b-f\uff1a\u663e\u793a\u8be6\u7ec6\u8fdb\u7a0b\u4fe1\u606f-l\uff1a\u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081718313561197.jpg\" class=\"aligncenter\" title=\"linux\u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u547d\u4ee4\u63d2\u56fe\" alt=\"linux\u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u547d\u4ee4\u63d2\u56fe\" \/><\/p>\n<p><strong>\u67e5\u770b Linux \u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u547d\u4ee4\uff1aps<\/strong><\/p>\n<p><strong>ps \u547d\u4ee4<\/strong>\u662f\u67e5\u770b Linux \u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u6700\u5e38\u7528\u547d\u4ee4\u3002\u5b83\u63d0\u4f9b\u6709\u5173\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u8fdb\u7a0b ID (PID)\u3001\u7528\u6237\u3001\u547d\u4ee4\u548c CPU \u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>ps [\u9009\u9879]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5e38\u7528\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li> <strong>-A<\/strong>\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff0c\u5305\u62ec\u5176\u4ed6\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>-e<\/strong>\uff1a\u7b49\u540c\u4e8e -A\u3002<\/li>\n<li> <strong>-u<\/strong>\uff1a\u663e\u793a\u6709\u5173\u7279\u5b9a\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u4fe1\u606f\u3002<\/li>\n<li> <strong>-x<\/strong>\uff1a\u663e\u793a\u65e0\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>-f<\/strong>\uff1a\u663e\u793a\u8be6\u7ec6\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u7ebf\u7a0b\u3001\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u548c\u6807\u5fd7\u3002<\/li>\n<li> <strong>-l<\/strong>\uff1a\u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa\uff0c\u5305\u62ec\u66f4\u591a\u4fe1\u606f\uff0c\u5982\u5f00\u59cb\u65f6\u95f4\u548c\u7d2f\u79ef CPU \u65f6\u95f4\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p><strong>\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff1a<\/strong><\/p>\n<pre>ps -A<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u663e\u793a\u6709\u5173\u5f53\u524d\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>ps -u $USER<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u663e\u793a\u8be6\u7ec6\u7684\u8fdb\u7a0b\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>ps -f<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>ps -l<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8f93\u51fa\u5185\u5bb9\uff1a<\/strong><\/p>\n<p>ps \u547d\u4ee4\u7684\u8f93\u51fa\u901a\u5e38\u5305\u542b\u4ee5\u4e0b\u5217\uff1a<\/p>\n<ul>\n<li> <strong>PID\uff1a<\/strong>\u8fdb\u7a0b ID<\/li>\n<li> <strong>USER\uff1a<\/strong>\u8fdb\u7a0b\u6240\u5c5e\u7528\u6237<\/li>\n<li> <strong>%CPU\uff1a<\/strong>\u8fdb\u7a0b\u5f53\u524d\u4f7f\u7528\u7684 CPU \u767e\u5206\u6bd4<\/li>\n<li> <strong>%MEM\uff1a<\/strong>\u8fdb\u7a0b\u5f53\u524d\u4f7f\u7528\u7684\u5185\u5b58\u767e\u5206\u6bd4<\/li>\n<li> <strong>VSZ\uff1a<\/strong>\u8fdb\u7a0b\u865a\u62df\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>RSS\uff1a<\/strong>\u8fdb\u7a0b\u5e38\u9a7b\u5185\u5b58\u5927\u5c0f<\/li>\n<li> <strong>TTY\uff1a<\/strong>\u8fdb\u7a0b\u6240\u8fde\u63a5\u7684\u7ec8\u7aef<\/li>\n<li> <strong>STAT\uff1a<\/strong>\u8fdb\u7a0b\u5f53\u524d\u72b6\u6001\uff08R \u8fd0\u884c\u3001S \u7761\u7720\u3001Z \u50f5\u5c38\uff09<\/li>\n<li> <strong>START\uff1a<\/strong>\u8fdb\u7a0b\u542f\u52a8\u65f6\u95f4<\/li>\n<li> <strong>TIME\uff1a<\/strong>\u8fdb\u7a0b\u7d2f\u79ef CPU \u65f6\u95f4<\/li>\n<li> <strong>COMMAND\uff1a<\/strong>\u8fdb\u7a0b\u547d\u4ee4<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>ps \u547d\u4ee4\u9700\u8981 root \u6743\u9650\u624d\u80fd\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u3002<\/li>\n<li>\u8f93\u51fa\u683c\u5f0f\u53ef\u80fd\u4f1a\u56e0 Linux \u53d1\u884c\u7248\u800c\u5f02\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u547d\u4ee4\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux \u67e5\u770b\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u547d\u4ee4\u4e3a psps\uff0c\u5b83\u53ef\u663e\u793a\u8fdb\u7a0b\u8be6\u7ec6\u4fe1\u606f\uff0c\u5982 pid\u3001\u7528\u6237\u3001\u547d\u4ee4\u548c cpu \u4f7f\u7528\u60c5\u51b5\u3002\u5e38\u7528\u9009\u9879\u5305\u62ec\uff1a-a\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b-u\uff1a\u663e\u793a\u7279\u5b9a\u7528\u6237\u7684\u8fdb\u7a0b\u4fe1\u606f-x\uff1a\u663e\u793a\u65e0\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b-f\uff1a\u663e\u793a\u8be6\u7ec6\u8fdb\u7a0b\u4fe1\u606f-l\uff1a\u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa \u67e5\u770b Linux \u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u547d\u4ee4\uff1aps ps \u547d\u4ee4\u662f\u67e5\u770b Linux \u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u6700\u5e38\u7528\u547d\u4ee4\u3002\u5b83\u63d0\u4f9b\u6709\u5173\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u8fdb\u7a0b ID (PID)\u3001\u7528\u6237\u3001\u547d\u4ee4\u548c CPU \u4f7f\u7528\u60c5\u51b5\u3002 \u8bed\u6cd5\uff1a ps [\u9009\u9879] \u767b\u5f55\u540e\u590d\u5236 \u5e38\u7528\u9009\u9879\uff1a -A\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff0c\u5305\u62ec\u5176\u4ed6\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u3002 -e\uff1a\u7b49\u540c\u4e8e -A\u3002 -u\uff1a\u663e\u793a\u6709\u5173\u7279\u5b9a\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u4fe1\u606f\u3002 -x\uff1a\u663e\u793a\u65e0\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b\u3002 -f\uff1a\u663e\u793a\u8be6\u7ec6\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u7ebf\u7a0b\u3001\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u548c\u6807\u5fd7\u3002 -l\uff1a\u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa\uff0c\u5305\u62ec\u66f4\u591a\u4fe1\u606f\uff0c\u5982\u5f00\u59cb\u65f6\u95f4\u548c\u7d2f\u79ef CPU \u65f6\u95f4\u3002 \u793a\u4f8b\uff1a \u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff1a ps -A \u767b\u5f55\u540e\u590d\u5236 \u663e\u793a\u6709\u5173\u5f53\u524d\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u4fe1\u606f\uff1a ps -u $USER \u767b\u5f55\u540e\u590d\u5236 \u663e\u793a\u8be6\u7ec6\u7684\u8fdb\u7a0b\u4fe1\u606f\uff1a ps -f \u767b\u5f55\u540e\u590d\u5236 \u663e\u793a\u957f\u683c\u5f0f\u8f93\u51fa\uff1a ps -l \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u5185\u5bb9\uff1a ps \u547d\u4ee4\u7684\u8f93\u51fa\u901a\u5e38\u5305\u542b\u4ee5\u4e0b\u5217\uff1a PID\uff1a\u8fdb\u7a0b ID USER\uff1a\u8fdb\u7a0b\u6240\u5c5e\u7528\u6237 [&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-18365","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18365","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=18365"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18365\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}