{"id":63109,"date":"2025-04-29T08:19:41","date_gmt":"2025-04-29T00:19:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63109\/"},"modified":"2025-04-29T08:19:41","modified_gmt":"2025-04-29T00:19:41","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8linux%e7%b3%bb%e7%bb%9f%e4%b8%ad%e6%a3%80%e6%9f%a5%e7%ab%af%e5%8f%a3%e6%98%af%e5%90%a6%e8%a2%ab%e5%8d%a0%e7%94%a8-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63109\/","title":{"rendered":"\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/170929981046213.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u63d2\u56fe\" alt=\"\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u63d2\u56fe\" \/><\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u4e00\u4e9b\u547d\u4ee4\u548c\u5de5\u5177\u6765\u5b9e\u73b0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u65b9\u6cd5\u548c\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<ol>\n<li>\n<p>\u4f7f\u7528netstat\u547d\u4ee4\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1a<br \/>netstat\u547d\u4ee4\u662f\u4e00\u4e2a\u7528\u6765\u663e\u793a\u7f51\u7edc\u72b6\u6001\u4fe1\u606f\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a<\/p>\n<pre>netstat -tuln | grep <\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\uff0c-t\u53c2\u6570\u8868\u793a\u663e\u793aTCP\u8fde\u63a5\uff0c-u\u53c2\u6570\u8868\u793a\u663e\u793aUDP\u8fde\u63a5\uff0c-l\u53c2\u6570\u8868\u793a\u4ec5\u663e\u793a\u76d1\u542c\u7aef\u53e3\uff0c-n\u53c2\u6570\u8868\u793a\u4ee5\u6570\u5b57\u5f62\u5f0f\u663e\u793a\u7aef\u53e3\u53f7\uff0cgrep \u7528\u6765\u7b5b\u9009\u6307\u5b9a\u7aef\u53e3\u7684\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528lsof\u547d\u4ee4\u67e5\u770b\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1a<br \/>lsof\u662f\u4e00\u4e2a\u80fd\u591f\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a<\/p>\n<pre>lsof -i:<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\uff0c-i\u53c2\u6570\u8868\u793a\u663e\u793a\u7f51\u7edc\u8fde\u63a5\u4fe1\u606f\uff0c:\u8868\u793a\u8981\u67e5\u8be2\u7684\u7aef\u53e3\u53f7\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528ss\u547d\u4ee4\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1a<br \/>ss\u547d\u4ee4\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u7f51\u7edc\u8fde\u63a5\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u663e\u793a\u7f51\u7edc\u5957\u63a5\u5b57\u7684\u72b6\u6001\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a<\/p>\n<pre>ss -tuln | grep <\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u4e09\u79cd\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u3002\u5982\u679c\u4ee5\u4e0a\u65b9\u6cd5\u68c0\u67e5\u5230\u7aef\u53e3\u88ab\u5360\u7528\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u7684\u547d\u4ee4\u67e5\u770b\u6b63\u5728\u4f7f\u7528\u8be5\u7aef\u53e3\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u8fdb\u800c\u505a\u51fa\u76f8\u5e94\u7684\u5904\u7406\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u4e00\u4e9b\u547d\u4ee4\u548c\u5de5\u5177\u6765\u5b9e\u73b0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u65b9\u6cd5\u548c\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff1a \u4f7f\u7528netstat\u547d\u4ee4\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1anetstat\u547d\u4ee4\u662f\u4e00\u4e2a\u7528\u6765\u663e\u793a\u7f51\u7edc\u72b6\u6001\u4fe1\u606f\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a netstat -tuln | grep \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff0c-t\u53c2\u6570\u8868\u793a\u663e\u793aTCP\u8fde\u63a5\uff0c-u\u53c2\u6570\u8868\u793a\u663e\u793aUDP\u8fde\u63a5\uff0c-l\u53c2\u6570\u8868\u793a\u4ec5\u663e\u793a\u76d1\u542c\u7aef\u53e3\uff0c-n\u53c2\u6570\u8868\u793a\u4ee5\u6570\u5b57\u5f62\u5f0f\u663e\u793a\u7aef\u53e3\u53f7\uff0cgrep \u7528\u6765\u7b5b\u9009\u6307\u5b9a\u7aef\u53e3\u7684\u4fe1\u606f\u3002 \u4f7f\u7528lsof\u547d\u4ee4\u67e5\u770b\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1alsof\u662f\u4e00\u4e2a\u80fd\u591f\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a lsof -i: \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff0c-i\u53c2\u6570\u8868\u793a\u663e\u793a\u7f51\u7edc\u8fde\u63a5\u4fe1\u606f\uff0c:\u8868\u793a\u8981\u67e5\u8be2\u7684\u7aef\u53e3\u53f7\u3002 \u4f7f\u7528ss\u547d\u4ee4\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff1ass\u547d\u4ee4\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u7f51\u7edc\u8fde\u63a5\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u663e\u793a\u7f51\u7edc\u5957\u63a5\u5b57\u7684\u72b6\u6001\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u68c0\u67e5\u7aef\u53e3\u5360\u7528\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff1a ss -tuln | grep \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u4ee5\u4e0a\u4e09\u79cd\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u6307\u5b9a\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u3002\u5982\u679c\u4ee5\u4e0a\u65b9\u6cd5\u68c0\u67e5\u5230\u7aef\u53e3\u88ab\u5360\u7528\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u7684\u547d\u4ee4\u67e5\u770b\u6b63\u5728\u4f7f\u7528\u8be5\u7aef\u53e3\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u8fdb\u800c\u505a\u51fa\u76f8\u5e94\u7684\u5904\u7406\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-63109","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63109","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=63109"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63109\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}