{"id":91599,"date":"2026-08-08T07:09:34","date_gmt":"2026-08-07T23:09:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91599.html"},"modified":"2026-08-08T07:09:34","modified_gmt":"2026-08-07T23:09:34","slug":"linux%e5%91%bd%e4%bb%a4-ss%ef%bc%88%e6%9f%a5%e7%9c%8b-socket-%e7%bb%9f%e8%ae%a1%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91599.html","title":{"rendered":"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09"},"content":{"rendered":"<\/p>\n<h4>Linux\u547d\u4ee4-ss&#xff08;\u67e5\u770b Socket \u7edf\u8ba1&#xff09;<\/h4>\n<ul>\n<li>\n<ul>\n<li>\u5feb\u901f\u53c2\u8003<\/li>\n<li>\u6838\u5fc3\u9009\u9879<\/li>\n<li>\u57fa\u672c\u7528\u6cd5<\/li>\n<li>\u6309\u72b6\u6001\u8fc7\u6ee4<\/li>\n<li>\u6309\u7aef\u53e3\/\u5730\u5740\u8fc7\u6ee4<\/li>\n<li>\u6309\u8fdb\u7a0b\u8fc7\u6ee4<\/li>\n<li>\u9ad8\u7ea7\u7528\u6cd5<\/li>\n<li>ss vs netstat \u5bf9\u6bd4<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>ss&#xff08;Socket Statistics&#xff09;\u662f netstat \u7684\u73b0\u4ee3\u66ff\u4ee3\u54c1&#xff0c;\u7528\u4e8e\u663e\u793a\u5957\u63a5\u5b57&#xff08;socket&#xff09;\u7edf\u8ba1\u4fe1\u606f\u3002\u5b83\u76f4\u63a5\u4ece\u5185\u6838\u83b7\u53d6\u4fe1\u606f&#xff0c;\u6bd4 netstat \u901f\u5ea6\u66f4\u5feb&#xff0c;\u4fe1\u606f\u66f4\u4e30\u5bcc&#xff0c;\u5c24\u5176\u662f\u5728\u7cfb\u7edf\u6709\u5927\u91cf\u8fde\u63a5\u65f6\u4f18\u52bf\u660e\u663e\u3002ss \u662f iproute2 \u5de5\u5177\u5305\u7684\u4e00\u90e8\u5206&#xff0c;\u5df2\u6210\u4e3a\u73b0\u4ee3 Linux \u7cfb\u7edf\u7f51\u7edc\u8bca\u65ad\u7684\u9996\u9009\u5de5\u5177\u3002<\/p>\n<h3>\u5feb\u901f\u53c2\u8003<\/h3>\n<p>ss <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">[<\/span>\u8fc7\u6ee4\u5668<span class=\"token punctuation\">]<\/span><\/p>\n<p>\u5185\u6838\u76f4\u8fbe&#xff1a;ss \u901a\u8fc7 Netlink \u63a5\u53e3\u76f4\u63a5\u4e0e\u5185\u6838\u901a\u4fe1\u83b7\u53d6\u5957\u63a5\u5b57\u4fe1\u606f&#xff0c;\u907f\u514d\u4e86 netstat \u8bfb\u53d6 \/proc \u6587\u4ef6\u7cfb\u7edf\u7684\u5f00\u9500\u3002<\/p>\n<h3>\u6838\u5fc3\u9009\u9879<\/h3>\n<table>\n<tr>\u9009\u9879\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>-t<\/td>\n<td>\u663e\u793a TCP \u5957\u63a5\u5b57<\/td>\n<\/tr>\n<tr>\n<td>-u<\/td>\n<td>\u663e\u793a UDP \u5957\u63a5\u5b57<\/td>\n<\/tr>\n<tr>\n<td>-l<\/td>\n<td>\u4ec5\u663e\u793a\u76d1\u542c\u72b6\u6001\u7684\u5957\u63a5\u5b57<\/td>\n<\/tr>\n<tr>\n<td>-a<\/td>\n<td>\u663e\u793a\u6240\u6709&#xff08;\u76d1\u542c&#043;\u975e\u76d1\u542c&#xff09;\u5957\u63a5\u5b57<\/td>\n<\/tr>\n<tr>\n<td>-n<\/td>\n<td>\u4ee5\u6570\u5b57\u5f62\u5f0f\u663e\u793a\u5730\u5740\u548c\u7aef\u53e3&#xff08;\u4e0d\u89e3\u6790\u57df\u540d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>-p<\/td>\n<td>\u663e\u793a\u4f7f\u7528\u8be5\u5957\u63a5\u5b57\u7684\u8fdb\u7a0b\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-s<\/td>\n<td>\u663e\u793a\u7edf\u8ba1\u6458\u8981<\/td>\n<\/tr>\n<tr>\n<td>-o<\/td>\n<td>\u663e\u793a\u8ba1\u65f6\u5668\u4fe1\u606f&#xff08;keepalive\u3001\u91cd\u4f20\u7b49&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>-e<\/td>\n<td>\u663e\u793a\u8be6\u7ec6\u7684\u5957\u63a5\u5b57\u5185\u5b58\u4f7f\u7528\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-m<\/td>\n<td>\u663e\u793a\u5957\u63a5\u5b57\u5185\u5b58\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td>-r<\/td>\n<td>\u89e3\u6790\u4e3b\u673a\u540d<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>\u663e\u793a\u5185\u90e8 TCP \u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-4\/-6<\/td>\n<td>\u53ea\u663e\u793a IPv4\/IPv6 \u5957\u63a5\u5b57<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u57fa\u672c\u7528\u6cd5<\/h3>\n<p><span class=\"token comment\"># \u663e\u793a\u6240\u6709\u5df2\u5efa\u7acb\u7684 TCP \u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u6240\u6709 TCP \u5957\u63a5\u5b57&#xff08;\u542b\u76d1\u542c&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-ta<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u6240\u6709\u76d1\u542c\u72b6\u6001\u7684 TCP\/UDP \u5957\u63a5\u5b57<\/span><br \/>\nss <span class=\"token parameter variable\">-tul<\/span><\/p>\n<p><span class=\"token comment\"># \u6700\u5e38\u7528\u7ec4\u5408&#xff1a;\u663e\u793a\u6240\u6709\u76d1\u542c\u7aef\u53e3\u53ca\u5bf9\u5e94\u8fdb\u7a0b<\/span><br \/>\nss <span class=\"token parameter variable\">-tulnp<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u6240\u6709\u5df2\u5efa\u7acb\u7684\u8fde\u63a5&#xff08;\u542b\u8fdb\u7a0b\u540d\u548c\u7aef\u53e3\u53f7&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-tnp<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u7edf\u8ba1\u6458\u8981<\/span><br \/>\nss <span class=\"token parameter variable\">-s<\/span><br \/>\n<span class=\"token comment\"># Total: 245<\/span><br \/>\n<span class=\"token comment\"># TCP:   32 (estab 12, closed 15, &#8230;)<\/span><br \/>\n<span class=\"token comment\"># &#8230;<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u8ba1\u65f6\u5668\u4fe1\u606f<\/span><br \/>\nss <span class=\"token parameter variable\">-to<\/span><\/p>\n<h3>\u6309\u72b6\u6001\u8fc7\u6ee4<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709 ESTABLISHED \u72b6\u6001\u7684 TCP \u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state established<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709 LISTEN \u72b6\u6001\u7684\u5957\u63a5\u5b57<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state listening<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b TIME-WAIT \u72b6\u6001\u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state time-wait<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b CLOSE-WAIT \u72b6\u6001\u7684\u8fde\u63a5&#xff08;\u53ef\u80fd\u8868\u793a\u8fde\u63a5\u6cc4\u6f0f&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state close-wait<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b SYN-SENT \u548c SYN-RECV \u72b6\u6001&#xff08;\u7528\u4e8e\u8bca\u65ad\u8fde\u63a5\u95ee\u9898&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state syn-sent syn-recv<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709\u975e\u76d1\u542c TCP \u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state all exclude listening<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b FIN-WAIT \u72b6\u6001\u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state fin-wait-1 fin-wait-2<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8fde\u63a5\u72b6\u6001\u5206\u5e03\u7edf\u8ba1<\/span><br \/>\nss <span class=\"token parameter variable\">-ta<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">awk<\/span> <span class=\"token string\">&#039;{print $1}&#039;<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">sort<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">uniq<\/span> <span class=\"token parameter variable\">-c<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">sort<\/span> <span class=\"token parameter variable\">-rn<\/span><\/p>\n<h3>\u6309\u7aef\u53e3\/\u5730\u5740\u8fc7\u6ee4<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b\u76ee\u6807\u7aef\u53e3\u4e3a 80 \u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> dst :80<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6e90\u7aef\u53e3\u4e3a 80 \u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> src :80<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6e90\u7aef\u53e3\u6216\u76ee\u6807\u7aef\u53e3\u4e3a 80 \u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> <span class=\"token string\">&#039;( dport &#061; :80 or sport &#061; :80 )&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6765\u81ea\u7279\u5b9a IP \u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> dst <span class=\"token number\">192.168<\/span>.1.100<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8fde\u63a5\u5230\u7279\u5b9a\u5b50\u7f51\u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> dst <span class=\"token number\">10.0<\/span>.0.0\/8<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u7279\u5b9a\u7aef\u53e3\u8303\u56f4\u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> dst :1024-65535<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8fde\u63a5\u5230 192.168.1.1:443 \u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> dst <span class=\"token number\">192.168<\/span>.1.1:443<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u5c0f\u4e8e 1024 \u7aef\u53e3\u7684\u76d1\u542c\u670d\u52a1<\/span><br \/>\nss <span class=\"token parameter variable\">-tlnp<\/span> sport lt :1024<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u5927\u4e8e\u7b49\u4e8e 8080 \u7aef\u53e3\u7684\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tn<\/span> sport ge :8080<\/p>\n<h3>\u6309\u8fdb\u7a0b\u8fc7\u6ee4<\/h3>\n<p><span class=\"token comment\"># \u67e5\u770b Nginx \u7684\u6240\u6709\u8fde\u63a5&#xff08;\u9700\u8981 -p \u9009\u9879&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-tnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> nginx<\/p>\n<p><span class=\"token comment\"># \u65b9\u5f0f\u4e8c&#xff1a;\u4f7f\u7528 -p \u9009\u9879\u5e76\u914d\u5408\u72b6\u6001\u8fc7\u6ee4<\/span><br \/>\nss <span class=\"token parameter variable\">-tp<\/span> state established <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> nginx<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u67d0\u4e2a PID \u7684\u6240\u6709\u8fde\u63a5<\/span><br \/>\nss <span class=\"token parameter variable\">-tnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token string\">&#034;pid&#061;1234&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u7edf\u8ba1\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u8fde\u63a5\u6570<\/span><br \/>\nss <span class=\"token parameter variable\">-tnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">awk<\/span> -F<span class=\"token string\">&#039;&#034;&#039;<\/span> <span class=\"token string\">&#039;{print $2}&#039;<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">sort<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">uniq<\/span> <span class=\"token parameter variable\">-c<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">sort<\/span> <span class=\"token parameter variable\">-rn<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">head<\/span> <span class=\"token parameter variable\">-10<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b SSH \u670d\u52a1\u7684\u76d1\u542c\u72b6\u6001<\/span><br \/>\nss <span class=\"token parameter variable\">-tlnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> sshd<\/p>\n<h3>\u9ad8\u7ea7\u7528\u6cd5<\/h3>\n<p><span class=\"token comment\"># \u663e\u793a\u5957\u63a5\u5b57\u5185\u5b58\u4f7f\u7528\u8be6\u60c5<\/span><br \/>\nss <span class=\"token parameter variable\">-tem<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a TCP \u5185\u90e8\u4fe1\u606f&#xff08;MSS\u3001\u62e5\u585e\u7a97\u53e3\u7b49&#xff09;<\/span><br \/>\nss <span class=\"token parameter variable\">-ti<\/span><\/p>\n<p><span class=\"token comment\"># \u7ed3\u5408\u8ba1\u65f6\u5668\u548c\u8fdb\u7a0b\u4fe1\u606f<\/span><br \/>\nss <span class=\"token parameter variable\">-topn<\/span><\/p>\n<p><span class=\"token comment\"># \u5b9e\u65f6\u76d1\u63a7\u8fde\u63a5\u53d8\u5316&#xff08;\u4f7f\u7528 watch&#xff09;<\/span><br \/>\n<span class=\"token function\">watch<\/span> <span class=\"token parameter variable\">-n<\/span> <span class=\"token number\">1<\/span> <span class=\"token string\">&#039;ss -tn state established | wc -l&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u76d1\u63a7 ESTABLISHED \u8fde\u63a5\u6570\u7684\u53d8\u5316\u8d8b\u52bf<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;<span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">date<\/span> <span class=\"token string\">&#039;&#043;%H:%M:%S&#039;<\/span><span class=\"token variable\">)<\/span><\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span>ss <span class=\"token parameter variable\">-tn<\/span> state established <span class=\"token operator\">|<\/span> <span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-n<\/span> &#043;2 <span class=\"token operator\">|<\/span> <span class=\"token function\">wc<\/span> <span class=\"token parameter variable\">-l<\/span><span class=\"token variable\">)<\/span><\/span>&#034;<\/span><br \/>\n    <span class=\"token function\">sleep<\/span> <span class=\"token number\">1<\/span><br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<p><span class=\"token comment\"># \u8bca\u65ad TIME-WAIT \u8fc7\u591a\u7684\u670d\u52a1\u5668<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;TIME-WAIT \u8fde\u63a5\u6570: <span class=\"token variable\"><span class=\"token variable\">$(<\/span>ss <span class=\"token parameter variable\">-tn<\/span> state time-wait <span class=\"token operator\">|<\/span> <span class=\"token function\">wc<\/span> <span class=\"token parameter variable\">-l<\/span><span class=\"token variable\">)<\/span><\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5 CLOSE-WAIT \u8fde\u63a5\u6cc4\u6f0f<\/span><br \/>\nss <span class=\"token parameter variable\">-tnp<\/span> state close-wait<br \/>\n<span class=\"token comment\"># \u5927\u91cf CLOSE-WAIT \u53ef\u80fd\u8868\u793a\u5e94\u7528\u7a0b\u5e8f\u672a\u6b63\u786e\u5173\u95ed\u8fde\u63a5<\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u5185\u6838\u7ef4\u62a4\u7684\u5957\u63a5\u5b57\u5185\u5b58\u7edf\u8ba1<\/span><br \/>\nss <span class=\"token parameter variable\">-m<\/span><\/p>\n<p><span class=\"token comment\"># \u6309\u72b6\u6001\u5206\u7ec4\u7edf\u8ba1<\/span><br \/>\nss <span class=\"token parameter variable\">-t<\/span> state established <span class=\"token string\">&#039;( sport &#061; :443 )&#039;<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">wc<\/span> <span class=\"token parameter variable\">-l<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;HTTPS \u6d3b\u8dc3\u8fde\u63a5: <span class=\"token variable\">$?<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b Docker \u5bb9\u5668\u7aef\u53e3\u6620\u5c04<\/span><br \/>\nss <span class=\"token parameter variable\">-tlnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> docker-proxy<\/p>\n<h3>ss vs netstat \u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u7279\u6027ssnetstat<\/tr>\n<tbody>\n<tr>\n<td>\u901f\u5ea6<\/td>\n<td>\u6781\u5feb&#xff08;Netlink \u63a5\u53e3&#xff09;<\/td>\n<td>\u8f83\u6162&#xff08;\u8bfb\u53d6 \/proc&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u578b\u670d\u52a1\u5668<\/td>\n<td>\u65e0\u6027\u80fd\u95ee\u9898<\/td>\n<td>\u53ef\u80fd\u5361\u987f<\/td>\n<\/tr>\n<tr>\n<td>\u8fc7\u6ee4\u8bed\u6cd5<\/td>\n<td>\u4e30\u5bcc\u7684\u72b6\u6001\/\u7aef\u53e3\u8fc7\u6ee4<\/td>\n<td>\u4ec5 grep \u8fc7\u6ee4<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u6838\u4fe1\u606f<\/td>\n<td>\u663e\u793a TCP \u5185\u90e8\u72b6\u6001<\/td>\n<td>\u6709\u9650<\/td>\n<\/tr>\n<tr>\n<td>\u9ed8\u8ba4\u5b89\u88c5<\/td>\n<td>iproute2 \u5305<\/td>\n<td>net-tools \u5305<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token comment\"># \u540c\u4e00\u529f\u80fd\u7684\u547d\u4ee4\u5bf9\u6bd4<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-tulnp<\/span>   <span class=\"token comment\"># \u2192 ss -tulnp<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-an<\/span>      <span class=\"token comment\"># \u2192 ss -an<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-s<\/span>       <span class=\"token comment\"># \u2192 ss -s<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-i<\/span>       <span class=\"token comment\"># \u2192 ip -s link<\/span><\/p>\n<p><span class=\"token comment\"># \u6027\u80fd\u5bf9\u6bd4\u6d4b\u8bd5<\/span><br \/>\n<span class=\"token function\">time<\/span> <span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-tan<\/span> <span class=\"token operator\">&gt;<\/span> \/dev\/null<br \/>\n<span class=\"token function\">time<\/span> ss <span class=\"token parameter variable\">-tan<\/span> <span class=\"token operator\">&gt;<\/span> \/dev\/null<br \/>\n<span class=\"token comment\"># ss \u901a\u5e38\u5feb 10 \u500d\u4ee5\u4e0a&#xff08;\u5728\u8fde\u63a5\u6570\u4e0a\u4e07\u65f6\u4f18\u52bf\u660e\u663e&#xff09;<\/span><\/p>\n<p>\u6700\u4f73\u5b9e\u8df5&#xff1a;\u5728\u65e5\u5e38\u7f51\u7edc\u8bca\u65ad\u4e2d&#xff0c;\u4f18\u5148\u4f7f\u7528 ss \u66ff\u4ee3 netstat\u3002\u5728\u9ad8\u5e76\u53d1\u670d\u52a1\u5668\u4e0a&#xff0c;ss \u7684\u901f\u5ea6\u4f18\u52bf\u5c24\u4e3a\u7a81\u51fa\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u547d\u4ee4-ss&#xff08;\u67e5\u770b Socket \u7edf\u8ba1&#xff09;\u5feb\u901f\u53c2\u8003\u6838\u5fc3\u9009\u9879\u57fa\u672c\u7528\u6cd5\u6309\u72b6\u6001\u8fc7\u6ee4\u6309\u7aef\u53e3\/\u5730\u5740\u8fc7\u6ee4\u6309\u8fdb\u7a0b\u8fc7\u6ee4\u9ad8\u7ea7\u7528\u6cd5ss vs netstat \u5bf9\u6bd4ss&#xff08;Socket Statistics&#xff09;\u662f netstat \u7684\u73b0\u4ee3\u66ff\u4ee3\u54c1&#xff0c;\u7528\u4e8e\u663e\u793a\u5957\u63a5\u5b57&#xff08;socket&#xff09;\u7edf\u8ba1\u4fe1\u606f\u3002\u5b83\u76f4\u63a5\u4ece\u5185\u6838\u83b7\u53d6\u4fe1\u606f&#xff0c;\u6bd4 netstat \u901f\u5ea6\u66f4\u5feb&#xff0c;\u4fe1\u606f\u66f4\u4e30\u5bcc&#xff0c;\u5c24\u5176\u662f\u5728\u7cfb\u7edf<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-91599","post","type-post","status-publish","format-standard","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/91599.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Linux\u547d\u4ee4-ss&#xff08;\u67e5\u770b Socket \u7edf\u8ba1&#xff09;\u5feb\u901f\u53c2\u8003\u6838\u5fc3\u9009\u9879\u57fa\u672c\u7528\u6cd5\u6309\u72b6\u6001\u8fc7\u6ee4\u6309\u7aef\u53e3\/\u5730\u5740\u8fc7\u6ee4\u6309\u8fdb\u7a0b\u8fc7\u6ee4\u9ad8\u7ea7\u7528\u6cd5ss vs netstat \u5bf9\u6bd4ss&#xff08;Socket Statistics&#xff09;\u662f netstat \u7684\u73b0\u4ee3\u66ff\u4ee3\u54c1&#xff0c;\u7528\u4e8e\u663e\u793a\u5957\u63a5\u5b57&#xff08;socket&#xff09;\u7edf\u8ba1\u4fe1\u606f\u3002\u5b83\u76f4\u63a5\u4ece\u5185\u6838\u83b7\u53d6\u4fe1\u606f&#xff0c;\u6bd4 netstat \u901f\u5ea6\u66f4\u5feb&#xff0c;\u4fe1\u606f\u66f4\u4e30\u5bcc&#xff0c;\u5c24\u5176\u662f\u5728\u7cfb\u7edf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91599.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-07T23:09:34+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91599.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91599.html\",\"name\":\"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-07T23:09:34+00:00\",\"dateModified\":\"2026-08-07T23:09:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91599.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91599.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91599.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/91599.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Linux\u547d\u4ee4-ss&#xff08;\u67e5\u770b Socket \u7edf\u8ba1&#xff09;\u5feb\u901f\u53c2\u8003\u6838\u5fc3\u9009\u9879\u57fa\u672c\u7528\u6cd5\u6309\u72b6\u6001\u8fc7\u6ee4\u6309\u7aef\u53e3\/\u5730\u5740\u8fc7\u6ee4\u6309\u8fdb\u7a0b\u8fc7\u6ee4\u9ad8\u7ea7\u7528\u6cd5ss vs netstat \u5bf9\u6bd4ss&#xff08;Socket Statistics&#xff09;\u662f netstat \u7684\u73b0\u4ee3\u66ff\u4ee3\u54c1&#xff0c;\u7528\u4e8e\u663e\u793a\u5957\u63a5\u5b57&#xff08;socket&#xff09;\u7edf\u8ba1\u4fe1\u606f\u3002\u5b83\u76f4\u63a5\u4ece\u5185\u6838\u83b7\u53d6\u4fe1\u606f&#xff0c;\u6bd4 netstat \u901f\u5ea6\u66f4\u5feb&#xff0c;\u4fe1\u606f\u66f4\u4e30\u5bcc&#xff0c;\u5c24\u5176\u662f\u5728\u7cfb\u7edf","og_url":"https:\/\/www.wsisp.com\/helps\/91599.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-07T23:09:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91599.html","url":"https:\/\/www.wsisp.com\/helps\/91599.html","name":"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-07T23:09:34+00:00","dateModified":"2026-08-07T23:09:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91599.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91599.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91599.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u547d\u4ee4-ss\uff08\u67e5\u770b Socket \u7edf\u8ba1\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=91599"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91599\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91599"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}