{"id":1092,"date":"2025-07-28T13:36:34","date_gmt":"2025-07-28T05:36:34","guid":{"rendered":"https:\/\/www.hgfwq.com\/blog\/?p=1092"},"modified":"2025-07-28T13:36:34","modified_gmt":"2025-07-28T05:36:34","slug":"linux%e6%9f%a5%e7%9c%8b%e4%bb%80%e4%b9%88%e5%9c%a8%e8%b7%91%e6%b5%81%e9%87%8f%e7%9a%84%e5%87%a0%e7%a7%8d%e6%96%b9%e6%b3%95%e4%b8%8e%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/www.hgfwq.com\/blog\/1092.html","title":{"rendered":"linux\u67e5\u770b\u4ec0\u4e48\u5728\u8dd1\u6d41\u91cf\u7684\u51e0\u79cd\u65b9\u6cd5\u4e0e\u5de5\u5177"},"content":{"rendered":"<p><p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e86\u89e3\u54ea\u4e9b\u8fdb\u7a0b\u6b63\u5728\u5360\u7528\u7f51\u7edc\u6d41\u91cf\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u548c\u6027\u80fd\u76d1\u63a7\u81f3\u5173\u91cd\u8981\u3002\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u67e5\u770bLinux\u7cfb\u7edf\u4e2d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u53ca\u5176\u5bf9\u5e94\u7684\u7f51\u7edc\u6d41\u91cf\u3002<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.hgfwq.com\/blog\/wp-content\/uploads\/2025\/07\/4JfBp.jpg\" alt=\"linux\u67e5\u770b\u4ec0\u4e48\u5728\u8dd1\u6d41\u91cf\u7684\u51e0\u79cd\u65b9\u6cd5\u4e0e\u5de5\u5177\" title=\"linux\u67e5\u770b\u4ec0\u4e48\u5728\u8dd1\u6d41\u91cf\u7684\u51e0\u79cd\u65b9\u6cd5\u4e0e\u5de5\u5177\"><\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907<\/h2>\n<\/p>\n<p><p>\u786e\u4fdd\u60a8\u6709\u8db3\u591f\u7684\u6743\u9650\u6765\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u901a\u5e38\u9700\u8981root\u6743\u9650\u6216\u8005\u4f7f\u7528sudo\u3002<\/p>\n<\/p>\n<p><h2>\u4efb\u52a1\uff1a\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u53ca\u5176\u7f51\u7edc\u6d41\u91cf<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa41\uff1a\u4f7f\u7528<code>netstat<\/code>\u547d\u4ee4<\/h3>\n<\/p>\n<p><p><code>netstat<\/code>\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u663e\u793a\u7f51\u7edc\u8fde\u63a5\u3001\u8def\u7531\u8868\u3001\u63a5\u53e3\u7edf\u8ba1\u4fe1\u606f\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code>sudo netstat -tunap<\/code><\/pre>\n<\/p>\n<p><p>\u89e3\u91ca\uff1a<\/p>\n<p>  &#8211; <code>-t<\/code> \u663e\u793aTCP\u8fde\u63a5\u3002<\/p>\n<p>  &#8211; <code>-u<\/code> \u663e\u793aUDP\u8fde\u63a5\u3002<\/p>\n<p>  &#8211; <code>-n<\/code> \u663e\u793a\u6570\u5b57\u5f62\u5f0f\u7684\u5730\u5740\u548c\u7aef\u53e3\u53f7\u3002<\/p>\n<p>  &#8211; <code>-p<\/code> \u663e\u793a\u54ea\u4e2a\u8fdb\u7a0b\u521b\u5efa\u4e86\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa42\uff1a\u4f7f\u7528<code>lsof<\/code>\u547d\u4ee4<\/h3>\n<\/p>\n<p><p><code>lsof<\/code>\u662f\u4e00\u4e2a\u5217\u51fa\u6253\u5f00\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u54ea\u4e9b\u8fdb\u7a0b\u6b63\u5728\u4f7f\u7528\u7f51\u7edc\u3002<\/p>\n<\/p>\n<p><pre><code>sudo lsof -i<\/code><\/pre>\n<\/p>\n<p><p>\u89e3\u91ca\uff1a<\/p>\n<p>  &#8211; <code>-i<\/code> \u663e\u793a\u7f51\u7edc\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa43\uff1a\u4f7f\u7528<code>iftop<\/code>\u547d\u4ee4<\/h3>\n<\/p>\n<p><p><code>iftop<\/code>\u662f\u4e00\u4e2a\u663e\u793a\u7f51\u7edc\u63a5\u53e3\u5e26\u5bbd\u4f7f\u7528\u60c5\u51b5\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><pre><code>sudo iftop<\/code><\/pre>\n<\/p>\n<p><p>\u89e3\u91ca\uff1a<\/p>\n<p>  &#8211; \u8fd9\u5c06\u663e\u793a\u6240\u6709\u7f51\u7edc\u63a5\u53e3\u7684\u5e26\u5bbd\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa44\uff1a\u4f7f\u7528<code>vnstat<\/code>\u547d\u4ee4<\/h3>\n<\/p>\n<p><p><code>vnstat<\/code>\u662f\u4e00\u4e2a\u7f51\u7edc\u6d41\u91cf\u76d1\u89c6\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u76d1\u63a7\u7f51\u7edc\u63a5\u53e3\u7684\u6d41\u91cf\u3002<\/p>\n<\/p>\n<p><pre><code>sudo vnstat -l<\/code><\/pre>\n<\/p>\n<p><p>\u89e3\u91ca\uff1a<\/p>\n<p>  &#8211; <code>-l<\/code> \u663e\u793a\u6240\u6709\u63a5\u53e3\u7684\u5386\u53f2\u6d41\u91cf\u3002<\/p>\n<\/p>\n<p><h2>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u548c\u6ce8\u610f\u4e8b\u9879<\/h2>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u60a8\u6709\u6743\u9650\u8fd0\u884c\u8fd9\u4e9b\u547d\u4ee4\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u8bf7\u4f7f\u7528sudo\u3002<\/li>\n<li>\u67d0\u4e9b\u547d\u4ee4\u53ef\u80fd\u9700\u8981\u5b89\u88c5\uff0c\u4f8b\u5982<code>iftop<\/code>\u548c<code>vnstat<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528<code>apt-get install iftop vnstat<\/code>\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<li>\u5bf9\u4e8e\u5927\u578b\u7f51\u7edc\uff0c\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u53ef\u80fd\u4f1a\u4ea7\u751f\u5927\u91cf\u8f93\u51fa\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ba1\u9053\u548cgrep\u7b49\u5de5\u5177\u8fdb\u884c\u8fc7\u6ee4\u3002<\/li>\n<\/ul>\n<p><h2>\u5b9e\u7528\u6280\u5de7<\/h2>\n<\/p>\n<ul>\n<li>\u5b9a\u671f\u68c0\u67e5\u7f51\u7edc\u6d41\u91cf\u53ef\u4ee5\u5e2e\u52a9\u60a8\u53d1\u73b0\u5f02\u5e38\u884c\u4e3a\u6216\u6f5c\u5728\u7684\u5b89\u5168\u5a01\u80c1\u3002<\/li>\n<li>\u5982\u679c\u9700\u8981\u66f4\u8be6\u7ec6\u7684\u76d1\u63a7\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u4e13\u4e1a\u7684\u7f51\u7edc\u76d1\u63a7\u5de5\u5177\u3002<\/li>\n<\/ul>\n<p>&#8220;`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e86\u89e3\u54ea\u4e9b\u8fdb\u7a0b\u6b63\u5728\u5360\u7528\u7f51\u7edc\u6d41\u91cf\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u548c\u6027\u80fd\u76d1\u63a7\u81f3\u5173\u91cd\u8981\u3002\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u67e5\u770bLinux\u7cfb\u7edf\u4e2d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u53ca\u5176\u5bf9\u5e94\u7684\u7f51\u7edc\u6d41\u91cf\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907 \u786e\u4fdd\u60a8\u6709\u8db3\u591f\u7684\u6743\u9650\u6765\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u901a\u5e38\u9700\u8981root\u6743\u9650\u6216\u8005\u4f7f\u7528sudo\u3002 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":1093,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50,450,449],"topic":[],"class_list":["post-1092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-haiwai","tag-linux","tag-netstat","tag-449"],"_links":{"self":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/1092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/comments?post=1092"}],"version-history":[{"count":1,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/1092\/revisions"}],"predecessor-version":[{"id":1095,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/1092\/revisions\/1095"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/media\/1093"}],"wp:attachment":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/media?parent=1092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/categories?post=1092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/tags?post=1092"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/topic?post=1092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}