﻿{"id":14282,"date":"2022-03-25T08:26:24","date_gmt":"2022-03-25T00:26:24","guid":{"rendered":"https:\/\/www.linuxmi.com\/?p=14282"},"modified":"2022-03-23T20:05:27","modified_gmt":"2022-03-23T12:05:27","slug":"linux-top-command","status":"publish","type":"post","link":"https:\/\/www.linuxmi.com\/linux-top-command.html","title":{"rendered":"\u6211\u6700\u559c\u6b22\u7684 Linux top \u547d\u4ee4\u9009\u9879"},"content":{"rendered":"<p>\u5f53\u6211\u68c0\u67e5 Linux \u7cfb\u7edf\uff08\u6216\u8005\u751a\u81f3\u5bf9\u8fd0\u884c\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u7684\u8ba1\u7b97\u673a\u8fdb\u884c\u6545\u969c\u6392\u9664\uff09\u65f6\uff0c\u6211\u7ecf\u5e38\u4f7f\u7528 top \u547d\u4ee4\u6765\u68c0\u67e5\u7cfb\u7edf\u7684 RAM \u548c CPU \u5360\u7528\u7387\u3002\u5b83\u4e3a\u6211\u63d0\u4f9b\u4e86\u8bc4\u4f30\u8ba1\u7b97\u673a\u6574\u4f53\u5065\u5eb7\u72b6\u51b5\u7684\u4fe1\u606f\u3002\u6211\u5728 Linux \u4e4b\u65c5\u7684\u65e9\u671f\u5c31\u4e86\u89e3\u4e86 top \u547d\u4ee4\uff0c\u5e76\u4f9d\u9760\u5b83\u8ba9\u6211\u5feb\u901f\u4e86\u89e3\u670d\u52a1\u5668\u6216\u5176\u4ed6 Linux \u7cfb\u7edf\uff08\u5305\u62ec Raspberry Pi\uff09\u4e0a\u6b63\u5728\u53d1\u751f\u7684\u4e8b\u60c5\u3002\u4f46 top \u547d\u4ee4\u8fdc\u6bd4\u4eba\u4eec\u770b\u5230\u7684\u8981\u590d\u6742\u5f97\u591a\u3002\u6839\u636e\u5176\u624b\u518c\u9875\uff0ctop \u7a0b\u5e8f\u63d0\u4f9b\u4e86\u6b63\u5728\u8fd0\u884c\u7684\u7cfb\u7edf\u7684\u52a8\u6001\u5b9e\u65f6\u89c6\u56fe\u3002\u5b83\u53ef\u4ee5\u663e\u793a\u7cfb\u7edf\u6458\u8981\u4fe1\u606f\u4ee5\u53ca\u5f53\u524d\u7531 Linux \u5185\u6838\u7ba1\u7406\u7684\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u5217\u8868\u3002<\/p>\n<p>\u4f46\u662f\uff0ctop \u547d\u4ee4\u7684\u610f\u4e49\u8fdc\u4e0d\u6b62\u773c\u524d\u6240\u89c1\u3002\u60a8\u7684\u547d\u4ee4\u7684\u7279\u5b9a\u529f\u80fd top \u53ef\u80fd\u4f1a\u56e0\u60a8\u8fd0\u884c\u7684\u7248\u672c\uff08procps-ng\u3001Busybox\u3001BSD\uff09\u800c\u5f02\uff0c\u56e0\u6b64\u8bf7\u53c2\u9605\u624b\u518c\u9875\u4e86\u89e3\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p>\u8981\u542f\u52a8 top\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi:~\/www.linuxmi.com$ top<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14284\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u663e\u793a\u5728 top \u5c4f\u5e55\u4e0a\u7684\u8868\u683c\u6807\u9898\u4e0b\u65b9\uff0c\u7cfb\u7edf\u7edf\u8ba1\u4fe1\u606f\u663e\u793a\u5728\u5176\u4e0a\u65b9\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">top - 09:46:05 up  1:33,  1 user,  load average: 0.76, 0.67, 0.74\r\n\u4efb\u52a1: 350 total,   1 running, 349 sleeping,   0 stopped,   0 zombie\r\n%Cpu(s):  1.0 us,  0.7 sy,  0.0 ni, 97.8 id,  0.0 wa,  0.0 hi,  0.5 si,  0.\r\nMiB Mem :   3886.8 total,    307.9 free,   2175.1 used,   1403.8 buff\/cache\r\nMiB Swap:   2048.0 total,    435.8 free,   1612.2 used.   1332.7 avail Mem \r\n\r\n \u8fdb\u7a0b\u53f7 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ \r\n   5816 mssql     20   0 9489420 315860  26100 S   2.3   7.9   2:12.97 \r\n     99 root       0 -20       0      0      0 I   0.7   0.0   0:09.20 \r\n   1141 root      20   0  242936   6504   5452 S   0.7   0.2   0:37.47 \r\n  11835 linuxmi   20   0 4041480 290588  75920 S   0.7   7.3   2:16.77 \r\n   1924 root      20   0   66412   4732   4156 S   0.3   0.1   0:14.17 \r\n   2815 vcache    20   0  278864  87112  85116 S   0.3   2.2   0:03.56 \r\n   3371 linuxmi+  20   0  190672   5148   3132 S   0.3   0.1   0:04.49 \r\n   3598 linuxmi+  20   0   57108   2404   2032 S   0.3   0.1   0:16.62 \r\n   5864 tr_test   20   0  190672   5780   3080 S   0.3   0.1   0:04.62 \r\n<\/code><\/pre>\n<p>\u6309 <strong>Z <\/strong>\u952e\u66f4\u6539\u8f93\u51fa\u7684\u989c\u8272\u3002\u6211\u53d1\u73b0\u8fd9\u8ba9\u8f93\u51fa\u66f4\u5bb9\u6613\u88ab\u773c\u775b\u770b\u5230\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14285\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-z.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p>\u6309<strong>1<\/strong>\u952e\u53ef\u67e5\u770b\u7cfb\u7edf\u4e0a\u6bcf\u4e2a CPU \u5185\u6838\u7684\u56fe\u5f62\u8868\u793a\u3002\u53cd\u590d\u6309<strong>1<\/strong>\u4ee5\u8bc4\u4f30 CPU \u5185\u6838\u7684\u5185\u6838\u7edf\u8ba1\u4fe1\u606f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14286\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-1.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528<code>top<\/code>\u547d\u4ee4\u7136\u540e\u6309<strong>m<\/strong>\u952e\u4ee5\u56fe\u5f62\u65b9\u5f0f\u663e\u793a\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14287\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-m.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p><strong>\u6709\u7528\u7684 top \u9009\u9879<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u53ea\u67e5\u627e\u7531\u7279\u5b9a\u7528\u6237\u542f\u52a8\u7684\u8fdb\u7a0b\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b <strong>-u<\/strong> \u9009\u9879\u83b7\u53d6\u8be5\u4fe1\u606f\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi:~\/www.linuxmi.com$ top -u 'root'<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14289\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-u.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p>\u8981\u83b7\u53d6\u7cfb\u7edf\u4e0a\u7684\u7a7a\u95f2\u8fdb\u7a0b\u5217\u8868\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b <strong>-i<\/strong> \u9009\u9879\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi:~\/www.linuxmi.com$ top -i<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14290\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-i.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u5c06\u66f4\u65b0\u95f4\u9694\u8bbe\u7f6e\u4e3a\u4ee5\u79d2\u4e3a\u5355\u4f4d\u7684\u4efb\u610f\u503c\u3002\u9ed8\u8ba4\u503c\u4e3a 3 \u79d2\u3002\u50cf\u8fd9\u6837\u5c06\u5176\u66f4\u6539\u4e3a 5\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi:~\/www.linuxmi.com$ top -d 5<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14291\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-d.png\" alt=\"\" width=\"892\" height=\"633\" \/><\/p>\n<p>\u60a8\u4e5f\u53ef\u4ee5 top \u5728\u8ba1\u65f6\u5668\u4e0a\u8fd0\u884c\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u547d\u4ee4\u5c06\u8fed\u4ee3\u6b21\u6570\u8bbe\u7f6e\u4e3a\u4e24\u6b21\uff0c\u7136\u540e\u9000\u51fa\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">linuxmi@linuxmi:~\/www.linuxmi.com$ top -n 2<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14293\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-2.png\" alt=\"\" width=\"992\" height=\"686\" \/><\/p>\n<p><strong>\u7528 top \u5b9a\u4f4d\u4e00\u4e2a\u8fdb\u7a0b<\/strong><\/p>\n<p>\u6309Shift+L\u6309\u540d\u79f0\u67e5\u627e\u8fdb\u7a0b\u3002\u8fd9\u4f1a\u5728\u7c97\u4f53\u8868\u6807\u9898\u884c\u4e0a\u65b9\u521b\u5efa\u4e00\u4e2a\u63d0\u793a\u3002\u8f93\u5165\u60a8\u8981\u67e5\u627e\u7684\u8fdb\u7a0b\u7684\u540d\u79f0\uff0c\u7136\u540e\u6309Enter\u6216Return\u4ee5\u67e5\u770b\u5728\u65b0\u6392\u5e8f\u7684\u8fdb\u7a0b\u5217\u8868\u4e2d\u9ad8\u4eae\u663e\u793a\u8be5\u8fdb\u7a0b\u7684\u5b9e\u4f8b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14295\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-l.png\" alt=\"\" width=\"992\" height=\"686\" \/><\/p>\n<p><strong>\u4f7f\u7528 top \u505c\u6b62\u8fdb\u7a0b<\/strong><\/p>\n<p>\u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528 top \u505c\u6b62\u6216\u201ckill\u201d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002\u9996\u5148\uff0c\u4f7f\u7528 Shift+L \u6216\u627e\u5230\u8981\u505c\u6b62\u7684\u8fdb\u7a0b\u00a0<code>pgrep<\/code>\u3002\u63a5\u4e0b\u6765\uff0c\u6309 K \u5e76\u8f93\u5165\u8981\u505c\u6b62\u7684\u8fdb\u7a0b ID\u3002\u9ed8\u8ba4\u503c\u662f\u5217\u8868\u9876\u90e8\u7684\u4efb\u4f55\u503c\uff0c\u56e0\u6b64\u8bf7\u786e\u4fdd\u5728\u6309 Enter \u4e4b\u524d\u8f93\u5165\u8981\u505c\u6b62\u7684 PID \uff0c\u5426\u5219\u60a8\u53ef\u80fd\u4f1a\u505c\u6b62\u60a8\u4e0d\u6253\u7b97\u505c\u6b62\u7684\u8fdb\u7a0b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14296\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2022\/03\/top-k.png\" alt=\"\" width=\"992\" height=\"608\" \/><\/p>\n<p><strong>top \u8fed\u4ee3<\/strong><\/p>\n<p>\u8be5\u547d\u4ee4\u6709\u8bb8\u591a\u8fed\u4ee3 top\uff0c\u5305\u62ec htop\u3001atop\u3001btop \u548c ttop\u3002\u4e5f\u6709\u4e13\u95e8\u7684 top \u547d\u4ee4\uff0c\u4f8b\u5982 Linux \u7701\u7535\u5de5\u5177 powertop \u548c\u76d1\u63a7\u7f51\u7edc\u6d41\u91cf\u5de5\u5177 ntop\u3002<\/p>\n<p><strong>\u76f8\u5173\u6587\u7ae0\uff1a<\/strong><\/p>\n<ul>\n<li>htop \u2013 Linux\u7684\u4ea4\u4e92\u5f0f\u8fdb\u7a0b\u67e5\u770b\u5668 <a href=\"https:\/\/www.linuxmi.com\/htop-linux.html\">https:\/\/www.linuxmi.com\/htop-linux.html<\/a><\/li>\n<li>Linux\u4e0b\u76847\u4e2a\u7cfb\u7edf\u76d1\u89c6\u5de5\u5177 <a href=\"https:\/\/www.linuxmi.com\/top-linux-htop-atop-more.html\">https:\/\/www.linuxmi.com\/top-linux-htop-atop-more.html<\/a><\/li>\n<li>5 \u6b3e\u57fa\u4e8e\u7ec8\u7aef\u7684\u6700\u4f73 Linux \u76d1\u63a7\u5de5\u5177 <a href=\"https:\/\/www.linuxmi.com\/5-terminal-linux-monitoring-tools.html\">https:\/\/www.linuxmi.com\/5-terminal-linux-monitoring-tools.html<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u6211\u68c0\u67e5 Linux \u7cfb\u7edf\uff08\u6216\u8005\u751a\u81f3\u5bf9\u8fd0\u884c\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u7684\u8ba1\u7b97\u673a\u8fdb\u884c\u6545\u969c\u6392\u9664\uff09\u65f6\uff0c\u6211\u7ecf\u5e38\u4f7f\u7528 top  &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[8,1019],"class_list":["post-14282","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linuxmingling","tag-top"],"aioseo_notices":[],"views":1103,"_links":{"self":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/14282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/comments?post=14282"}],"version-history":[{"count":6,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/14282\/revisions"}],"predecessor-version":[{"id":14298,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/14282\/revisions\/14298"}],"wp:attachment":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/media?parent=14282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/categories?post=14282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/tags?post=14282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}