{"id":293328,"date":"2024-09-30T20:05:12","date_gmt":"2024-09-30T12:05:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/gmlznqsjclfw.html"},"modified":"2024-09-30T20:05:12","modified_gmt":"2024-09-30T12:05:12","slug":"gmlznqsjclfw","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/gmlznqsjclfw.html","title":{"rendered":"5 \u4e2a\u547d\u4ee4\u52a9\u4f60\u8f7b\u677e\u68c0\u67e5 Linux \u670d\u52a1\u5668\u53ef\u7528\u5185\u5b58"},"content":{"rendered":"

linux\u4e2d\u68c0\u67e5\u53ef\u7528\u5185\u5b58\u5927\u5c0f\u7684\u51e0\u79cd\u65b9\u6cd5<\/p>\n

\u4f5c\u4e3alinux\u7528\u6237\uff0c\u975e\u5e38\u662f\u7ba1\u7406\u5458\uff0c\u6211\u4eec\u987b\u8981\u68c0\u6d4b\u7cfb\u7edf\u4f7f\u7528\u591a\u5c11\u663e\u5b58\u8d44\u6e90\u4ee5\u53ca\u6709\u591a\u5c11\u663e\u5b58\u8d44\u6e90\u662f\u7a7a\u95f2\u7684\u3002\u56e0\u4e3a\u6700\u91cd\u8981\u7684\u662f\u8981\u68c0\u6d4b\u670d\u52a1\u5668\u4e0a\u7684\u663e\u5b58\u8d44\u6e90\uff0c\u56e0\u800c\u6700\u597d\u5b66\u4e60\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8fdb\u884c\u670d\u52a1\u5668\u7ba1\u7406\u7684\u76f8\u5173\u547d\u4ee4<\/a>\u3002<\/p>\n

\u672c\u6587\u89e3\u91ca\u4e86\u4f7f\u7528\u4ee5\u4e0b5\u4e2a\u547d\u4ee4\u6765\u68c0\u6d4b\u53ef\u7528\u663e\u5b58\uff1a<\/p>\n

1\u3001free\u547d\u4ee4<\/p>\n

2\u3001vmstat\u547d\u4ee4<\/p>\n

3\u3001\/proc\/meminfo\u547d\u4ee4<\/p>\n

4\u3001top\u547d\u4ee4<\/p>\n

5\u3001htop\u547d\u4ee4<\/p>\n

\u901a\u8fc7\u4f7f\u7528\u90a3\u4e9b\u547d\u4ee4\uff0c\u60a8\u4ecd\u7136\u53ef\u4ee5\u786e\u4fdd\u6709\u8db3\u591f\u7684\u663e\u5b58\u8d44\u6e90\u7528\u4e8e\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684\u7279\u522b\u91cd\u8981\u7684\u8fdb\u7a0b\u3002\u8bf8\u5982\uff0c\u5047\u82e5\u60a8\u6b63\u5728\u8fd0\u884cWeb\u670d\u52a1\u5668\uff0c\u5219\u53ef\u4ee5\u786e\u4fdd\u7f3a\u4e4f\u8d44\u6e90\u4e0d\u4f1a\u589e\u52a0\u7f51\u7ad9\u8bbf\u95ee\u901f\u7387\uff0c\u6216\u5219\u7f51\u7ad9\u4e0d\u4f1a\u5b8c\u5168\u505c\u6b62\u8fd0\u884c\u3002<\/p>\n

\u6211\u4eec\u5728CentOS7.5\u7cfb\u7edf\u4e0a\u8fd0\u884c\u4e86\u672c\u6587\u4e2d\u63d0\u53ca\u7684\u547d\u4ee4\u548c\u8fc7\u7a0blinux\u7cfb\u7edf\u5b98\u7f51\uff0cUbuntuLinux<\/a>\u4e0a\u4e5f\u4e00\u6837\u3002<\/p>\n

\u4e3a\u4e86\u67e5\u770b\u663e\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u6211\u4eec\u4f7f\u7528\u7684\u662fLinux\u547d\u4ee4\u884c\uff0c\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edfDash\u6253\u5f00\u7ec8\u7aef\u3002<\/p>\n

\u65b9\u5f0f1\uff1afree\u547d\u4ee4<\/p>\n

\u56e0\u4e3afree\u547d\u4ee4\u662f\u6700\u5e7f\u6cdb\u4f7f\u7528\u7684\uff0c\u6beb\u65e0\u7591\u60d1\u662f\u6700\u6709\u7528\u7684\uff0c\u6211\u4eec\u9996\u5148\u4f1a\u63d0\u53ca\u5b83\u7684\u7528\u6cd5\u3002\u6b64\u547d\u4ee4\u7528\u4e8e\u68c0\u6d4b\u6709\u5173\u7cfb\u7edfRAM\u4f7f\u7528\u60c5\u51b5\u7684\u4fe1\u606f\u3002\u4ee5\u4e0b\u662f\u60a8\u5c06\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u7684\u547d\u4ee4\uff1a<\/p>\n

available\u5217\u8868\u793a\u53ef\u7528\u663e\u5b58\u3002<\/p>\n

Swap\u6761\u76ee\u4e2dused\u7684\u5217\u662f51\uff0c\u8fd9\u610f\u5473\u7740\u5b83\u4f7f\u7528\u4e8651M\uff0c\u7a7a\u95f2\u90e8\u4efd\u662f1996M\u3002<\/p>\n

\u5185\u5b58\u547d\u4ee4\u67e5\u770b_linux\u67e5\u770b\u5185\u5b58\u547d\u4ee4_linux\u67e5\u770b\u5185\u5b58\u6761\u547d\u4ee4<\/p>\n

\u514d\u8d39\u89c6\u9891\u6559\u7a0b\u5206\u4eab\uff1alinux\u89c6\u9891\u6559\u7a0b<\/p>\n

\u65b9\u5f0f2\uff1avmstat\u547d\u4ee4<\/p>\n

\u8981\u901a\u8fc7vmstat\u547d\u4ee4\u67e5\u770b\u663e\u5b58\u7edf\u8ba1\u4fe1\u606f\uff0c\u53ef\u4ee5\u6309\u4ee5\u4e0b\u65b9\u6cd5\u4f7f\u7528\u5b83\uff1a<\/p>\n

885979f82d9f0b60d36e477c599663f.png<\/p>\n

s\u6807\u7b7e\u63d0\u4f9b\u6709\u5173\u663e\u5b58\u4f7f\u7528\u7684\u8be6\u5c3d\u7edf\u8ba1\u4fe1\u606f\u3002<\/p>\n

\u60a8\u53ef\u4ee5\u5728\u8f93\u51fa\u4e2d\u67e5\u770b\u53ef\u7528\u663e\u5b58\u548c\u53ef\u7528\u4ea4\u6362\u663e\u5b58\u6761\u76ee\uff0c\u6307\u793a\u7cfb\u7edf\u4e2d\u7684\u53ef\u7528\u663e\u5b58\u3002<\/p>\n

\u65b9\u5f0f3\uff1a\/proc\/meminfo\u547d\u4ee4<\/p>\n

\u4ee5\u4e0b\u547d\u4ee4\u4ece\/proc\u6587\u4ef6\u7cfb\u7edf\u4e2d\u63d0\u53d6\u4e0e\u663e\u5b58\u76f8\u5173\u7684\u4fe1\u606f\u3002\u90a3\u4e9b\u6587\u4ef6\u5305\u542b\u6709\u5173\u7cfb\u7edf\u548c\u5185\u6838\u7684\u52a8\u6001\u4fe1\u606f\uff0c\u800c\u4e0d\u662f\u771f\u5b9e\u7684\u7cfb\u7edf\u6587\u4ef6\u3002<\/p>\n

linux\u67e5\u770b\u5185\u5b58\u547d\u4ee4_linux\u67e5\u770b\u5185\u5b58\u6761\u547d\u4ee4_\u5185\u5b58\u547d\u4ee4\u67e5\u770b<\/p>\n

\u8fd9\u662f\u7528\u4e8e\u590d\u5370\u663e\u5b58\u4fe1\u606f\u7684\u547d\u4ee4\uff1a<\/p>\n

666f14a9a9cf8c9f491b8fe8710de66.png<\/p>\n

\u6b64\u547d\u4ee4\u7684\u8f93\u51fa\u7c7b\u4f3c\u4e8evmstat\u547d\u4ee4\u3002\u60a8\u53ef\u4ee5\u8f7b\u677e\u67e5\u770bMemFree\u7ed3\u679c\u4e2d\u7684\u7a7a\u95f2\u663e\u5b58\u548cSwapFree\u7ed3\u679c\u4e2d\u7684\u53ef\u7528\u4ea4\u6362\u663e\u5b58\u3002<\/p>\n

\u65b9\u5f0f4\uff1atop\u547d\u4ee4<\/p>\n

top\u547d\u4ee4\u7528\u4e8e\u590d\u5370\u7cfb\u7edf\u7684CPU\u548c\u663e\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u60a8\u53ef\u4ee5\u6309\u5982\u4e0b\u5f62\u5f0f\u4f7f\u7528\u6b64\u547d\u4ee4\uff1a<\/p>\n

\u5728\u8f93\u51fa\u7684\u6807\u9898\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u89c1KiBMem\u548cKibSwap\u6761\u76ee\uff0c\u901a\u8fc7\u5b83\u4eec\u53ef\u4ee5\u68c0\u6d4b\u5df2\u7528\u548c\u53ef\u7528\u7684\u663e\u5b58\u8d44\u6e90\u3002<\/p>\n

\u65b9\u5f0f5\uff1ahtop\u547d\u4ee4<\/p>\n

\u5185\u5b58\u547d\u4ee4\u67e5\u770b_linux\u67e5\u770b\u5185\u5b58\u547d\u4ee4_linux\u67e5\u770b\u5185\u5b58\u6761\u547d\u4ee4<\/p>\n

\u5982\u540ctop\u547d\u4ee4\u4e00\u6837linux\u67e5\u770b\u5185\u5b58\u547d\u4ee4<\/strong>\uff0chtop\u547d\u4ee4\u4e5f\u4f1a\u8be6\u5c3d\u5256\u6790\u60a8\u7684CPU\u548c\u663e\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u5018\u82e5\u60a8\u7684\u7cfb\u7edf\u4e0a\u6ca1\u6709\u5b89\u88c5htop\uff0cUbuntu\u4e0b\u53ef\u4ee5\u5148\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0abt\u50a8\u5b58\u5e93\u6765\u5b89\u88c5\u5b83\uff1a<\/p>\n

\n

$ sudo apt-get update<\/pre>\n<\/p>\n

\u767b\u9646\u540e\u590d\u5236<\/p>\n

\u4e4b\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4<\/p>\n

\n

$ sudo apt install htop<\/pre>\n<\/p>\n

\u767b\u9646\u540e\u590d\u5236<\/p>\n

CentOS\u4e0b\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n

\n

[linuxidc@localhost ~]$ sudo yum install htop<\/pre>\n<\/p>\n

\u5185\u5b58\u547d\u4ee4\u67e5\u770b_linux\u67e5\u770b\u5185\u5b58\u6761\u547d\u4ee4_linux\u67e5\u770b\u5185\u5b58\u547d\u4ee4<\/p>\n

\u767b\u9646\u540e\u590d\u5236<\/p>\n

\u5b89\u88c5htop\u540elinux\u67e5\u770b\u5185\u5b58\u547d\u4ee4<\/strong>\uff0c\u60a8\u53ea\u9700\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u590d\u5370\u6240\u9700\u4fe1\u606f\uff1a<\/p>\n

\n

[linuxidc@localhost ~]$ htop<\/pre>\n<\/p>\n

\u767b\u9646\u540e\u590d\u5236<\/p>\n

\u6807\u9898\u4e2d\u7684Mem(Memory\u4e5f\u5c31\u662fRAM)\u548cSwp(Swap)\u6761\u76ee\u8868\u793a\u5df2\u7528\u548c\u603b\u663e\u5b58\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u4f30\u7b97\u7cfb\u7edf\u4e0a\u53ef\u7528\u7684\u53ef\u7528\u663e\u5b58\u3002<\/p>\n

\u4f7f\u7528\u6211\u4eec\u5728\u672c\u6587\u4e2d\u63d0\u53ca\u7684\u547d\u4ee4linux\u8ba1\u5212\u4efb\u52a1\uff0c\u60a8\u53ef\u4ee5\u76d1\u89c6\u7cfb\u7edf\u8fdb\u7a0b\u663e\u5b58\u60c5\u51b5\u3002\u60a8\u53ef\u4ee5\u5b8c\u5168\u4e0d\u4f7f\u7528GUI\uff0c\u4f46\u662f\u4f9d\u7136\u53ef\u4ee5\u68c0\u6d4b\u4e2a\u4eba\u8ba1\u7b97\u673a\u548c\u670d\u52a1\u5668\u4e0a\u7684\u663e\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e3a\u4e86\u67e5\u770b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u6211\u4eec\u4f7f\u7528\u7684\u662fLinux\u547d\u4ee4\u884c\uff0c\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u901a\u8fc7vmstat\u547d\u4ee4\u67e5\u770b\u5185\u5b58\u7edf\u8ba1\u4fe1\u606f\uff0c\u53ef\u4ee5\u6309\u4ee5\u4e0b\u65b9\u5f0f\u4f7f\u7528\u5b83\uff1a\u60a8\u53ef\u4ee5\u5728\u8f93\u51fa\u4e2d\u67e5\u770b\u53ef\u7528\u5185\u5b58\u548c\u53ef\u7528\u4ea4\u6362\u5185\u5b58\u6761\u76ee\uff0c\u6307\u793a\u7cfb\u7edf\u4e2d\u7684\u53ef\u7528\u5185\u5b58\u3002Swap\u6761\u76ee\uff0c\u901a\u8fc7\u5b83\u4eec\u53ef\u4ee5\u68c0\u67e5\u5df2\u7528\u548c\u53ef\u7528\u7684\u5185\u5b58\u8d44\u6e90\u3002<\/p>\n","protected":false},"author":1,"featured_media":293329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[3309,3311,3312,3310,3308],"class_list":["post-293328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-fml-3","tag-hml","tag-tml","tag-vml-3","tag-ncjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=293328"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293328\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/293329"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=293328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=293328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=293328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}