{"id":18388,"date":"2024-11-18T08:26:21","date_gmt":"2024-11-18T00:26:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18388\/"},"modified":"2024-11-18T08:26:21","modified_gmt":"2024-11-18T00:26:21","slug":"linux%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e5%86%85%e5%ad%98%e5%8d%a0%e7%94%a8%e8%bf%9b%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18388\/","title":{"rendered":"linux\u5982\u4f55\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b"},"content":{"rendered":"<blockquote><p>\n  \u67e5\u770b linux \u4e2d\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528 top \u547d\u4ee4\u6309\u5185\u5b58\u4f7f\u7528\u91cf\u6392\u5e8f\u8fdb\u7a0b\u3002\u4f7f\u7528 ps \u547d\u4ee4\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528 free \u547d\u4ee4\u67e5\u770b\u7cfb\u7edf\u6574\u4f53\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528 htop \u5de5\u5177\u4ea4\u4e92\u5f0f\u76d1\u63a7\u8fdb\u7a0b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528\u5176\u4ed6\u5de5\u5177\uff0c\u5982 procps\u3001vmstat \u548c pmap\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081718552078706.jpg\" class=\"aligncenter\" title=\"linux\u5982\u4f55\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\u63d2\u56fe\" alt=\"linux\u5982\u4f55\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\u63d2\u56fe\" \/><\/p>\n<p><strong>\u67e5\u770b Linux \u4e2d\u8fdb\u7a0b\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528 top \u547d\u4ee4<\/strong><\/p>\n<p>top \u547d\u4ee4\u53ef\u4ee5\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u4e2d\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<pre>top<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 top \u754c\u9762\u4e2d\uff0c\u6309 <strong>M<\/strong> \u952e\uff0c\u5c06\u6309\u7167\u5185\u5b58\u4f7f\u7528\u91cf\u4ece\u9ad8\u5230\u4f4e\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<p><strong>2. \u4f7f\u7528 ps \u547d\u4ee4<\/strong><\/p>\n<p>ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u5217\u8868\uff0c\u5e76\u5305\u62ec\u5176\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<pre>ps aux --sort -rss<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u4f7f\u7528 free \u547d\u4ee4<\/strong><\/p>\n<p>free \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u6574\u4f53\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u5305\u62ec\u6b63\u5728\u4f7f\u7528\u548c\u53ef\u7528\u7684\u5185\u5b58\u91cf\u3002<\/p>\n<pre>free -m<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4f7f\u7528 htop \u5de5\u5177<\/strong><\/p>\n<p>htop \u662f\u4e00\u6b3e\u4ea4\u4e92\u5f0f\u7684\u8fdb\u7a0b\u76d1\u63a7\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u6709\u5173\u8fdb\u7a0b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u7684\u8be6\u7ec6\u89c6\u56fe\u3002<\/p>\n<pre>sudo apt install htop\nhtop<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 htop \u754c\u9762\u4e2d\uff0c\u6309 <strong>F6<\/strong> \u952e\uff0c\u5c06\u6309\u7167\u5185\u5b58\u4f7f\u7528\u91cf\u4ece\u9ad8\u5230\u4f4e\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<p><strong>5. \u4f7f\u7528\u5176\u4ed6\u5de5\u5177<\/strong><\/p>\n<p>\u9664\u4e86\u4e0a\u8ff0\u547d\u4ee4\u5916\uff0c\u8fd8\u6709\u8bb8\u591a\u5176\u4ed6\u5de5\u5177\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li><strong>procps<\/strong><\/li>\n<li><strong>vmstat<\/strong><\/li>\n<li><strong>pmap<\/strong><\/li>\n<\/ul>\n<p>\u9009\u62e9\u6700\u9002\u5408\u60a8\u9700\u6c42\u7684\u65b9\u6cd5\uff0c\u4ee5\u67e5\u770b\u548c\u7ba1\u7406 Linux \u7cfb\u7edf\u4e2d\u7684\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u770b\u8fdb\u7a0b\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>\u67e5\u770b linux \u4e2d\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528 top \u547d\u4ee4\u6309\u5185\u5b58\u4f7f\u7528\u91cf\u6392\u5e8f\u8fdb\u7a0b\u3002\u4f7f\u7528 ps \u547d\u4ee4\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528 free \u547d\u4ee4\u67e5\u770b\u7cfb\u7edf\u6574\u4f53\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528 htop \u5de5\u5177\u4ea4\u4e92\u5f0f\u76d1\u63a7\u8fdb\u7a0b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u4f7f\u7528\u5176\u4ed6\u5de5\u5177\uff0c\u5982 procps\u3001vmstat \u548c pmap\u3002 \u67e5\u770b Linux \u4e2d\u8fdb\u7a0b\u7684\u65b9\u6cd5 \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b\u5185\u5b58\u5360\u7528\u8fdb\u7a0b\uff1a 1. \u4f7f\u7528 top \u547d\u4ee4 top \u547d\u4ee4\u53ef\u4ee5\u5b9e\u65f6\u663e\u793a\u7cfb\u7edf\u4e2d\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002 top \u767b\u5f55\u540e\u590d\u5236 \u5728 top \u754c\u9762\u4e2d\uff0c\u6309 M \u952e\uff0c\u5c06\u6309\u7167\u5185\u5b58\u4f7f\u7528\u91cf\u4ece\u9ad8\u5230\u4f4e\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u6392\u5e8f\u3002 2. \u4f7f\u7528 ps \u547d\u4ee4 ps \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u5217\u8868\uff0c\u5e76\u5305\u62ec\u5176\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002 ps aux &#8211;sort -rss \u767b\u5f55\u540e\u590d\u5236 3. \u4f7f\u7528 free \u547d\u4ee4 free \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u6574\u4f53\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u5305\u62ec\u6b63\u5728\u4f7f\u7528\u548c\u53ef\u7528\u7684\u5185\u5b58\u91cf\u3002 free -m \u767b\u5f55\u540e\u590d\u5236 4. \u4f7f\u7528 [&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-18388","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18388","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=18388"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18388\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}