{"id":656039,"date":"2024-01-08T10:15:09","date_gmt":"2024-01-08T02:15:09","guid":{"rendered":"http:\/\/puo.cn\/?p=656039"},"modified":"2026-01-08T10:16:29","modified_gmt":"2026-01-08T02:16:29","slug":"ssh%e4%b8%8b-%e6%9f%a5%e7%9c%8b%e6%9c%8d%e5%8a%a1%e5%99%a8vps%e5%86%85%e5%ad%98%e5%8d%a0%e7%94%a8%e6%83%85%e5%86%b5","status":"publish","type":"post","link":"http:\/\/puo.cn\/?p=656039","title":{"rendered":"ssh\u4e0b \u67e5\u770b\u670d\u52a1\u5668vps\u5185\u5b58\u5360\u7528\u60c5\u51b5"},"content":{"rendered":"<div class=\"ybc-p\">\u5728 SSH \u73af\u5883\u4e0b\u67e5\u770b VPS\uff08Linux \u670d\u52a1\u5668\uff09\u7684\u5185\u5b58\u5360\u7528\u6bd4\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u5e38\u7528\u547d\u4ee4\u5b9e\u73b0\uff0c\u64cd\u4f5c\u7b80\u5355\u4e14\u80fd\u76f4\u89c2\u83b7\u53d6\u6570\u636e\u3002<\/div>\n<h3><strong>\u65b9\u6cd5\u4e00\uff1a<code>free<\/code>\u547d\u4ee4\uff08\u6700\u5e38\u7528\uff09<\/strong><\/h3>\n<div class=\"ybc-p\"><code>free<\/code>\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u7cfb\u7edf\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff08\u7269\u7406\u5185\u5b58\u3001\u4ea4\u6362\u5206\u533a\uff09\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f\uff08\u5982\u4eba\u7c7b\u53ef\u8bfb\u7684\u5355\u4f4d\uff09\u3002<\/div>\n<h4><strong>\u57fa\u7840\u7528\u6cd5<\/strong><\/h4>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>free -h  # -h \u8868\u793a\u4ee5\u4eba\u7c7b\u53ef\u8bfb\u7684\u5355\u4f4d\uff08GB\/MB\uff09\u663e\u793a\uff08\u63a8\u8350\uff09\r\n# \u6216\u76f4\u63a5\u67e5\u770b\u539f\u59cb\u6570\u503c\uff08\u5355\u4f4d\u4e3a KB\uff09\uff1a\r\nfree<\/code><\/pre>\n<h4><strong>\u8f93\u51fa\u793a\u4f8b\uff08<code>free -h<\/code>\uff09<\/strong><\/h4>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>total        used        free      shared  buff\/cache   available\r\nMem:           3.7G        1.2G        456M         12M        2.1G        2.2G\r\nSwap:          2.0G          0B        2.0G<\/code><\/pre>\n<h4><strong>\u5173\u952e\u5b57\u6bb5\u89e3\u91ca<\/strong><\/h4>\n<ul class=\"ybc-ul-component\">\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>total<\/code>\uff1a\u603b\u5185\u5b58\u5927\u5c0f\uff08\u793a\u4f8b\u4e2d\u4e3a 3.7GB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>used<\/code>\uff1a\u5df2\u4f7f\u7528\u7684\u5185\u5b58\uff08\u5305\u542b\u5e94\u7528\u7a0b\u5e8f\u548c\u7cfb\u7edf\u7f13\u5b58\uff0c<strong>\u6ce8\u610f<\/strong>\uff1aLinux \u4f1a\u5c06\u7a7a\u95f2\u5185\u5b58\u7528\u4e8e\u7f13\u5b58\u4ee5\u63d0\u9ad8\u6027\u80fd\uff0c\u56e0\u6b64\u5b9e\u9645\u201c\u53ef\u7528\u201d\u5185\u5b58\u9700\u770b <code>available<\/code>\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>free<\/code>\uff1a\u5b8c\u5168\u672a\u4f7f\u7528\u7684\u5185\u5b58\uff08\u793a\u4f8b\u4e2d\u4e3a 456MB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>buff\/cache<\/code>\uff1a\u7f13\u51b2\u533a\uff08Buffer\uff09\u548c\u7f13\u5b58\uff08Cache\uff09\u5360\u7528\u7684\u5185\u5b58\uff08\u793a\u4f8b\u4e2d\u4e3a 2.1GB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>available<\/code>\uff1a<strong>\u5b9e\u9645\u53ef\u7528\u7684\u5185\u5b58<\/strong>\uff08\u4f30\u7b97\u503c\uff0c\u5305\u542b\u53ef\u56de\u6536\u7684\u7f13\u5b58\uff0c\u793a\u4f8b\u4e2d\u4e3a 2.2GB\uff09\u3002<\/div>\n<\/li>\n<\/ul>\n<h4><strong>\u8ba1\u7b97\u5185\u5b58\u5360\u7528\u6bd4\u4f8b<\/strong><\/h4>\n<div class=\"ybc-p\">\u82e5\u9700\u624b\u52a8\u8ba1\u7b97\u201c\u5df2\u7528\u5185\u5b58\u5360\u6bd4\u201d\uff08\u4e0d\u542b\u7f13\u5b58\uff09\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>\u5360\u7528\u6bd4\u4f8b = (used \/ total) \u00d7 100%<\/code><\/pre>\n<div class=\"ybc-p\">\u793a\u4f8b\u4e2d\uff1a<code>1.2G \/ 3.7G \u2248 32.4%<\/code>\uff08\u4f46\u5b9e\u9645\u53ef\u7528\u5185\u5b58\u66f4\u9ad8\uff0c\u56e0\u4e3a\u7f13\u5b58\u53ef\u56de\u6536\uff09\u3002<\/div>\n<div class=\"ybc-p\">\u82e5\u9700\u8ba1\u7b97\u201c\u5b9e\u9645\u4f7f\u7528\u5185\u5b58\u5360\u6bd4\u201d\uff08\u542b\u7f13\u5b58\uff09\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>\u5b9e\u9645\u4f7f\u7528\u5360\u6bd4 = ((total - available) \/ total) \u00d7 100%<\/code><\/pre>\n<div class=\"ybc-p\">\u793a\u4f8b\u4e2d\uff1a<code>(3.7G - 2.2G)\/3.7G \u2248 40.5%<\/code>\uff08\u66f4\u63a5\u8fd1\u771f\u5b9e\u8d1f\u8f7d\uff09\u3002<\/div>\n<h3><strong>\u65b9\u6cd5\u4e8c\uff1a<code>top<\/code>\u547d\u4ee4\uff08\u5b9e\u65f6\u76d1\u63a7\uff09<\/strong><\/h3>\n<div class=\"ybc-p\"><code>top<\/code>\u662f\u52a8\u6001\u76d1\u63a7\u5de5\u5177\uff0c\u53ef\u5b9e\u65f6\u67e5\u770b\u5185\u5b58\u3001CPU\u3001\u8fdb\u7a0b\u7684\u5360\u7528\u60c5\u51b5\u3002<\/div>\n<h4><strong>\u7528\u6cd5<\/strong><\/h4>\n<div class=\"ybc-p\">\u76f4\u63a5\u8f93\u5165\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>top<\/code><\/pre>\n<h4><strong>\u5173\u952e\u5185\u5b58\u5b57\u6bb5<\/strong><\/h4>\n<div class=\"ybc-p\">\u542f\u52a8\u540e\uff0c\u9876\u90e8\u4f1a\u663e\u793a\u5168\u5c40\u5185\u5b58\u4fe1\u606f\uff08\u793a\u4f8b\uff09\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>KiB Mem :  3880188 total,   467892 free,  1248568 used,  2163728 buff\/cache\r\nKiB Swap:  2097148 total,  2097148 free,        0 used.  2297820 avail Mem<\/code><\/pre>\n<ul class=\"ybc-ul-component\">\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>total<\/code>\uff1a\u603b\u5185\u5b58\uff083,880,188 KB \u2248 3.7GB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>free<\/code>\uff1a\u7a7a\u95f2\u5185\u5b58\uff08467,892 KB \u2248 457MB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>used<\/code>\uff1a\u5df2\u7528\u5185\u5b58\uff081,248,568 KB \u2248 1.19GB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>buff\/cache<\/code>\uff1a\u7f13\u5b58+\u7f13\u51b2\u533a\uff082,163,728 KB \u2248 2.06GB\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><code>avail Mem<\/code>\uff1a\u53ef\u7528\u5185\u5b58\uff082,297,820 KB \u2248 2.19GB\uff09\u3002<\/div>\n<\/li>\n<\/ul>\n<div class=\"ybc-p\">\u6309 <code>q<\/code>\u9000\u51fa\u76d1\u63a7\u3002<\/div>\n<h3><strong>\u65b9\u6cd5\u4e09\uff1a<code>htop<\/code>\u547d\u4ee4\uff08\u66f4\u53cb\u597d\u7684\u4ea4\u4e92\u754c\u9762\uff09<\/strong><\/h3>\n<div class=\"ybc-p\"><code>htop<\/code>\u662f <code>top<\/code>\u7684\u589e\u5f3a\u7248\uff08\u9700\u989d\u5916\u5b89\u88c5\uff09\uff0c\u754c\u9762\u66f4\u76f4\u89c2\uff0c\u652f\u6301\u9f20\u6807\u64cd\u4f5c\u548c\u989c\u8272\u9ad8\u4eae\u3002<\/div>\n<h4><strong>\u5b89\u88c5\u4e0e\u4f7f\u7528<\/strong><\/h4>\n<ul class=\"ybc-ul-component\">\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><strong>Debian\/Ubuntu<\/strong>\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>apt update &amp;&amp; apt install htop -y<\/code><\/pre>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><strong>CentOS\/RHEL<\/strong>\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>yum install epel-release -y &amp;&amp; yum install htop -y<\/code><\/pre>\n<\/li>\n<\/ul>\n<div class=\"ybc-p\">\u8fd0\u884c\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>htop<\/code><\/pre>\n<h4><strong>\u5185\u5b58\u663e\u793a<\/strong><\/h4>\n<div class=\"ybc-p\">\u754c\u9762\u9876\u90e8\u4f1a\u76f4\u63a5\u663e\u793a\u5185\u5b58\u548c\u4ea4\u6362\u5206\u533a\u7684\u4f7f\u7528\u6761\uff0c\u4ee5\u53ca\u5177\u4f53\u6570\u503c\uff08\u5982 <code>Mem: 1.2G\/3.7G<\/code>\uff09\uff0c\u975e\u5e38\u76f4\u89c2\u3002<\/div>\n<h3><strong>\u65b9\u6cd5\u56db\uff1a\u901a\u8fc7 <code>\/proc\/meminfo<\/code>\u6587\u4ef6\uff08\u539f\u59cb\u6570\u636e\uff09<\/strong><\/h3>\n<div class=\"ybc-p\">Linux \u7cfb\u7edf\u7684\u5185\u5b58\u4fe1\u606f\u5b58\u50a8\u5728 <code>\/proc\/meminfo<\/code>\u6587\u4ef6\u4e2d\uff0c\u53ef\u901a\u8fc7 <code>cat<\/code>\u67e5\u770b\u8be6\u7ec6\u6570\u636e\u3002<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>cat \/proc\/meminfo<\/code><\/pre>\n<h4><strong>\u5173\u952e\u884c\u793a\u4f8b<\/strong><\/h4>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>MemTotal:        3880188 kB  # \u603b\u5185\u5b58\r\nMemFree:          467892 kB  # \u7a7a\u95f2\u5185\u5b58\r\nMemAvailable:     2297820 kB  # \u53ef\u7528\u5185\u5b58\uff08\u4f30\u7b97\uff09\r\nBuffers:          123456 kB  # \u7f13\u51b2\u533a\r\nCached:          2040272 kB  # \u7f13\u5b58\r\nSwapTotal:       2097148 kB  # \u4ea4\u6362\u5206\u533a\u603b\u5927\u5c0f\r\nSwapFree:        2097148 kB  # \u4ea4\u6362\u5206\u533a\u7a7a\u95f2\u5927\u5c0f<\/code><\/pre>\n<h3><strong>\u603b\u7ed3<\/strong><\/h3>\n<ul class=\"ybc-ul-component\">\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><strong>\u5feb\u901f\u67e5\u770b<\/strong>\uff1a\u7528 <code>free -h<\/code>\uff08\u7b80\u6d01\u76f4\u89c2\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><strong>\u5b9e\u65f6\u76d1\u63a7<\/strong>\uff1a\u7528 <code>top<\/code>\u6216 <code>htop<\/code>\uff08\u52a8\u6001\u8ddf\u8e2a\u53d8\u5316\uff09\u3002<\/div>\n<\/li>\n<li class=\"ybc-li-component ybc-li-component_ul\">\n<div class=\"ybc-p\"><strong>\u7cbe\u786e\u8ba1\u7b97<\/strong>\uff1a\u901a\u8fc7 <code>\/proc\/meminfo<\/code>\u63d0\u53d6\u6570\u636e\u540e\u7528\u811a\u672c\u8ba1\u7b97\uff08\u5982 <code>awk<\/code>\uff09\u3002<\/div>\n<\/li>\n<\/ul>\n<div class=\"ybc-p\">\u5982\u679c\u9700\u8981\u81ea\u52a8\u5316\u76d1\u63a7\uff0c\u8fd8\u53ef\u4ee5\u7ed3\u5408 <code>watch<\/code>\u547d\u4ee4\u5b9a\u65f6\u5237\u65b0\uff08\u4f8b\u5982\u6bcf 2 \u79d2\u5237\u65b0\u4e00\u6b21\uff09\uff1a<\/div>\n<pre class=\"ybc-pre-component ybc-pre-component_not-math\"><code>watch -n 2 free -h  # \u6bcf 2 \u79d2\u5237\u65b0\u4e00\u6b21\u5185\u5b58\u72b6\u6001<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 SSH \u73af\u5883\u4e0b\u67e5\u770b VPS\uff08Linux \u670d\u52a1\u5668\uff09\u7684\u5185\u5b58\u5360\u7528\u6bd4\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u5e38\u7528\u547d\u4ee4\u5b9e\u73b0\uff0c\u64cd\u4f5c\u7b80\u5355\u4e14\u80fd\u76f4\u89c2\u83b7\u53d6\u6570\u636e\u3002 \u65b9\u6cd5\u4e00\uff1afree\u547d\u4ee4\uff08\u6700\u5e38\u7528\uff09 free\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u7cfb\u7edf\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff08\u7269\u7406\u5185\u5b58\u3001\u4ea4\u6362\u5206\u533a\uff09\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f\uff08\u5982&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[128],"tags":[19,935,1005],"topic":[],"class_list":["post-656039","post","type-post","status-publish","format-standard","hentry","category-128","tag-free","tag-935","tag-1005"],"_links":{"self":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/656039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=656039"}],"version-history":[{"count":1,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/656039\/revisions"}],"predecessor-version":[{"id":656040,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/656039\/revisions\/656040"}],"wp:attachment":[{"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=656039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=656039"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=656039"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=656039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}