{"id":63902,"date":"2025-04-29T10:26:10","date_gmt":"2025-04-29T02:26:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63902\/"},"modified":"2025-04-29T10:26:10","modified_gmt":"2025-04-29T02:26:10","slug":"linux%e6%9f%a5%e7%9c%8b%e8%bf%9b%e7%a8%8b%e5%8d%a0%e7%94%a8%e5%86%85%e5%ad%98%e5%a4%a7%e5%b0%8f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63902\/","title":{"rendered":"linux\u67e5\u770b\u8fdb\u7a0b\u5360\u7528\u5185\u5b58\u5927\u5c0f"},"content":{"rendered":"<blockquote><p>\n  \u67e5\u770b linux \u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\u6709\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\uff1a\u4f7f\u7528\u201cps -eo rss,comm\u201d\u547d\u4ee4\uff0c\u5176\u4e2d\u201cps\u201d\u663e\u793a\u8fdb\u7a0b\u4fe1\u606f\uff0c\u201c-eo rss,comm\u201d\u6307\u5b9a\u8f93\u51fa\u5217\u4e3a\u9a7b\u7559\u96c6\u5927\u5c0f\uff08rss\uff09\u548c\u547d\u4ee4\u540d\u79f0\u3002\u4f7f\u7528\u201ctop -o %mem\u201d\u547d\u4ee4\uff0c\u5176\u4e2d\u201ctop\u201d\u663e\u793a\u5b9e\u65f6\u8fdb\u7a0b\u4fe1\u606f\uff0c\u201c-o %mem\u201d\u6309\u5185\u5b58\u4f7f\u7528\u7387\u5bf9\u8fdb\u7a0b\u6392\u5e8f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081718580110096.jpg\" class=\"aligncenter\" title=\"linux\u67e5\u770b\u8fdb\u7a0b\u5360\u7528\u5185\u5b58\u5927\u5c0f\u63d2\u56fe\" alt=\"linux\u67e5\u770b\u8fdb\u7a0b\u5360\u7528\u5185\u5b58\u5927\u5c0f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Linux \u8fdb\u7a0b\u7684\u91cf<\/strong><\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\u6709\u51e0\u79cd\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u6700\u5e38\u7528\u7684\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528\u201cps\u201d\u547d\u4ee4<\/strong><\/p>\n<p>ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u4e2d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>ps -eo rss,comm<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>-eo \u9009\u9879\u6307\u5b9a\u8981\u663e\u793a\u7684\u8f93\u51fa\u5b57\u6bb5\u3002<\/li>\n<li>rss \u662f\u9a7b\u7559\u96c6\u5927\u5c0f\uff08RSS\uff09\u5217\uff0c\u663e\u793a\u8fdb\u7a0b\u4f7f\u7528\u7684\u7269\u7406\u5185\u5b58\u91cf\uff08\u4ee5\u5343\u5b57\u8282\u4e3a\u5355\u4f4d\uff09\u3002<\/li>\n<li>comm \u662f\u547d\u4ee4\u5217\uff0c\u663e\u793a\u8fdb\u7a0b\u7684\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p><strong>2. \u4f7f\u7528\u201ctop\u201d\u547d\u4ee4<\/strong><\/p>\n<p>top \u547d\u4ee4\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u8fdb\u7a0b\u76d1\u89c6\u5668\uff0c\u5b83\u53ef\u4ee5\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u4e2d\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>top -o %MEM<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>-o %MEM \u9009\u9879\u5bf9\u8fdb\u7a0b\u6309\u5185\u5b58\u4f7f\u7528\u7387\u8fdb\u884c\u6392\u5e8f\uff0c\u5e76\u5c06\u7ed3\u679c\u6309\u5185\u5b58\u4f7f\u7528\u7387\u7684\u964d\u5e8f\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 ps \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u5185\u5b58\u5360\u7528\u91cf\u7684\u793a\u4f8b\u8f93\u51fa\uff1a<\/p>\n<pre>COMMAND      RSS\ntop          6116\nbash         2884\nzsh          2012\n...<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u524d\u4e09\u4e2a\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u5176\u4e2d top \u8fdb\u7a0b\u4f7f\u7528\u4e86\u6700\u591a\u7684\u5185\u5b58\uff0c\u4e3a 6116 \u5343\u5b57\u8282\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 top \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u5185\u5b58\u5360\u7528\u91cf\u7684\u793a\u4f8b\u8f93\u51fa\uff1a<\/p>\n<pre>PID   USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND\n13942 user      20   0  2797920 134896  12100 S   0.3  2.0    0:00.20 top\n21873 root      20   0  1122044  20288  10664 S   0.0  0.4    0:00.25 bash\n18672 user      20   0  1062040  17776  10272 S   0.0  0.3    0:00.06 zsh\n...<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u6309\u5185\u5b58\u4f7f\u7528\u7387\u6392\u5e8f\u7684\u524d\u4e09\u4e2a\u8fdb\u7a0b\u3002top \u8fdb\u7a0b\u4f7f\u7528\u4e86\u6700\u591a\u7684\u5185\u5b58\uff0c\u4e3a 2.0%\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b\u8fdb\u7a0b\u5360\u7528\u5185\u5b58\u5927\u5c0f\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>\u67e5\u770b linux \u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\u6709\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\uff1a\u4f7f\u7528\u201cps -eo rss,comm\u201d\u547d\u4ee4\uff0c\u5176\u4e2d\u201cps\u201d\u663e\u793a\u8fdb\u7a0b\u4fe1\u606f\uff0c\u201c-eo rss,comm\u201d\u6307\u5b9a\u8f93\u51fa\u5217\u4e3a\u9a7b\u7559\u96c6\u5927\u5c0f\uff08rss\uff09\u548c\u547d\u4ee4\u540d\u79f0\u3002\u4f7f\u7528\u201ctop -o %mem\u201d\u547d\u4ee4\uff0c\u5176\u4e2d\u201ctop\u201d\u663e\u793a\u5b9e\u65f6\u8fdb\u7a0b\u4fe1\u606f\uff0c\u201c-o %mem\u201d\u6309\u5185\u5b58\u4f7f\u7528\u7387\u5bf9\u8fdb\u7a0b\u6392\u5e8f\u3002 \u5982\u4f55\u67e5\u770b Linux \u8fdb\u7a0b\u7684\u91cf \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\u6709\u51e0\u79cd\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u6700\u5e38\u7528\u7684\u4e24\u79cd\u65b9\u6cd5\uff1a 1. \u4f7f\u7528\u201cps\u201d\u547d\u4ee4 ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u4e2d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a ps -eo rss,comm \u767b\u5f55\u540e\u590d\u5236 -eo \u9009\u9879\u6307\u5b9a\u8981\u663e\u793a\u7684\u8f93\u51fa\u5b57\u6bb5\u3002 rss \u662f\u9a7b\u7559\u96c6\u5927\u5c0f\uff08RSS\uff09\u5217\uff0c\u663e\u793a\u8fdb\u7a0b\u4f7f\u7528\u7684\u7269\u7406\u5185\u5b58\u91cf\uff08\u4ee5\u5343\u5b57\u8282\u4e3a\u5355\u4f4d\uff09\u3002 comm \u662f\u547d\u4ee4\u5217\uff0c\u663e\u793a\u8fdb\u7a0b\u7684\u540d\u79f0\u3002 2. \u4f7f\u7528\u201ctop\u201d\u547d\u4ee4 top \u547d\u4ee4\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u8fdb\u7a0b\u76d1\u89c6\u5668\uff0c\u5b83\u53ef\u4ee5\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u4e2d\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002\u8981\u67e5\u770b\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a top -o %MEM \u767b\u5f55\u540e\u590d\u5236 -o %MEM \u9009\u9879\u5bf9\u8fdb\u7a0b\u6309\u5185\u5b58\u4f7f\u7528\u7387\u8fdb\u884c\u6392\u5e8f\uff0c\u5e76\u5c06\u7ed3\u679c\u6309\u5185\u5b58\u4f7f\u7528\u7387\u7684\u964d\u5e8f\u3002 \u793a\u4f8b \u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 ps \u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u5185\u5b58\u5360\u7528\u91cf\u7684\u793a\u4f8b\u8f93\u51fa\uff1a COMMAND RSS top 6116 bash 2884 zsh 2012 &#8230; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u524d\u4e09\u4e2a\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528\u91cf\uff0c\u5176\u4e2d [&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-63902","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63902","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=63902"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63902\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}