{"id":5133,"date":"2022-04-05T21:03:27","date_gmt":"2022-04-05T13:03:27","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=5133"},"modified":"2022-04-05T21:03:27","modified_gmt":"2022-04-05T13:03:27","slug":"%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3windows%e7%b3%bb%e7%bb%9f%e5%92%8clinux%e7%b3%bb%e7%bb%9f%e4%b8%ad%e7%ab%af%e5%8f%a3%e8%a2%ab%e5%8d%a0%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/5133.html","title":{"rendered":"\u5982\u4f55\u89e3\u51b3windows\u7cfb\u7edf\u548clinux\u7cfb\u7edf\u4e2d\u7aef\u53e3\u88ab\u5360\u7528"},"content":{"rendered":"
\u4e00\u3001\u5728windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d,\u67e5\u8be2\u7aef\u53e3\u5360\u7528\u548c\u6e05\u9664\u7aef\u53e3\u5360\u7528\u7684\u7a0b\u5e8f<\/b><\/p>\n
1\u3001\u67e5\u8be2\u7aef\u53e3\u5360\u7528\u7684\u8fdb\u7a0bID<\/span><\/b><\/p>\n \u70b9\u51fb<\/span>\"\u5f00\u59cb\"-->\"\u8fd0\u884c\",\u8f93\u5165\"cmd\"\u540e\u70b9\u51fb\u786e\u5b9a\u6309\u94ae,\u8fdb\u5165DOS\u7a97\u53e3,\u63a5\u4e0b\u6765\u5206\u522b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:<\/p>\n netstat -a -n \u5404\u4e2a\u7aef\u53e3\u5360\u7528<\/p>\n netstat -ano \u5404\u4e2a\u7aef\u53e3\u5360\u7528\u548c\u8fdb\u7a0bPID<\/p>\n netstat -aon | findstr \"80\"<\/p>\n C:Usersadmin>netstat -aon|findstr \"80\"<\/p>\n TCP 127.0.0.1:9080 0.0.0.0:0 LISTENING 4632<\/p>\n 2\u3001\u67e5\u770b\u7aef\u53e3\u53f7\u6240\u5bf9\u5e94\u7684\u5e94\u7528\u7a0b\u5e8f<\/b><\/p>\n tasklist | findstr \" 4632\"<\/p>\n \u8865\u5145<\/span>: tasklist \/fi \"pid eq 4632\"<\/p>\n GROOVE.EXE 4632 Console 1 84,880 K<\/p>\n \u5f88\u660e\u663e<\/span>,\u662fGROOVE.EXE \u5360\u7528\u4e8680\u7aef\u53e3,GROOVE.EXE \u4e00\u4e2aIE\u7684ACTIVEX\u63a7\u4ef6\u3002<\/p>\n 3\u3001\u7ec8\u6b62\u8fdb\u7a0b<\/b><\/p>\n taskkill \/pid 4632 \/F<\/p>\n \u6216\u5219\u4f7f\u7528<\/span>\u00a0taskkill \/f \/t \/im GROOVE.exe<\/p>\n \u518d\u6b21\u67e5\u8be2\u662f\u5426\u6210\u529f\u7ec8\u6b62<\/p>\n tasklist | findstr \"4632\"<\/p>\n \u5982\u679c\u6210\u529f\u7ec8\u6b62\u6b64\u6b21\u6267\u884c\u547d\u4ee4\u540e\u5e94\u8fd4\u56de\u7a7a<\/span>.,\u5219\u8868\u793a\u6210\u529f,\u7ec8\u6b62 PID \u4e3a 4632 \u7684\u8fdb\u7a0b\u3002<\/p>\n \u4e8c\u3001\u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d,\u67e5\u8be2\u7aef\u53e3\u5360\u7528\u548c\u6e05\u9664\u7aef\u53e3\u5360\u7528\u7684\u7a0b\u5e8f<\/b><\/p>\n 1\u3001\u67e5\u8be2\u7aef\u53e3\u53f7\u5360\u7528,\u6839\u636e\u7aef\u53e3\u67e5\u770b\u8fdb\u7a0b\u4fe1\u606f<\/b><\/p>\n [root@server2 ~]# lsof -i:80<\/p>\n COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME<\/p>\n httpd 5014 root 3u IPv4 14346 TCP server2:http (LISTEN)<\/p>\n 2\u3001\u6839\u636e\u8fdb\u7a0b\u53f7\u67e5\u770b\u8fdb\u7a0b\u5bf9\u5e94\u7684\u53ef\u6267\u884c\u7a0b\u5e8f<\/b><\/p>\n ps -f -p \u8fdb\u7a0b\u53f7<\/p>\n # ps -f -p 5014<\/p>\n UID PID PPID C STIME TTY TIME CMD<\/p>\n root 5014 1 0 17:26 ? 00:00:00 \/usr\/local\/apache\/bin\/httpd -k<\/p>\n 3\u3001\u6839\u636e\u53ef\u6267\u884c\u7a0b\u5e8f\u67e5\u770b\u52a8\u6001\u94fe\u63a5<\/b><\/p>\n ldd \u53ef\u6267\u884c\u6587\u4ef6\u540d<\/p>\n ldd \/usr\/local\/apache\/bin\/httpd<\/p>\n linux-vdso.so.1 => (0x00007fff9dc90000)<\/p>\n libaprutil-0.so.0 => \/usr\/local\/apache\/lib\/libaprutil-0.so.0 (0x00002af026fcd000)<\/p>\n 4\u3001\u6839\u636e\u7aef\u53e3\u53f7\u5f97\u5230\u5176\u5360\u7528\u7684\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f<\/b><\/p>\n netstat -tlnp|grep 80<\/p>\n tcp 0 0 192.168.33.10:80 0.0.0.0:* LISTEN 5014\/httpd<\/p>\n tcp 0 0 0.0.0.0:48054 0.0.0.0:* LISTEN 5386\/java<\/p>\n \u8fd9\u4e00\u6b65\u9aa4\u7b49\u4e8e\u521a\u624d\u4e0a\u9762\u7684\u4e00\u4e8c\u4e24\u4e2a\u6b65\u9aa4<\/p>\n 5\u3001\u6839\u636e\u7aef\u53e3\u53f7\u67e5\u8be2,\u67e5\u8be2\u5176\u5360\u7528\u8fdb\u7a0bID<\/b><\/p>\n netstat -tlnp|grep 80|awk {print 7}|awk -F \/ {print 1}<\/p>\n 5014<\/p>\n \u6216\u5219\u662f\u7528\u4e0b\u9762\u7684\u547d\u4ee4<\/p>\n netstat -pan|grep 80<\/p>\n NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]<\/p>\n -\u00a0a \u663e\u793a\u6240\u6709\u8fde\u63a5\u548c\u76d1\u542c\u7aef\u53e3\u3002<\/p>\n -b \u663e<\/p>\n \u793a\u5305\u542b\u4e8e\u521b\u5efa\u6bcf\u4e2a\u8fde\u63a5\u6216\u76d1\u542c\u7aef\u53e3\u7684\u53ef\u6267\u884c\u7ec4\u4ef6\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5df2\u77e5\u53ef\u6267\u884c\u7ec4\u4ef6<\/p>\n \u62e5\u6709\u591a\u4e2a\u72ec\u7acb\u7ec4\u4ef6<\/span>,\u5e76\u4e14\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\u5305\u542b\u4e8e\u521b\u5efa\u8fde\u63a5\u6216\u76d1\u542c\u7aef\u53e3\u7684\u7ec4\u4ef6\u5e8f\u5217\u88ab\u663e\u793a\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b,\u53ef\u6267\u884c\u7ec4\u4ef6\u540d \u5728\u5e95\u90e8\u7684 []<\/p>\n \u4e2d<\/span>,\u9876\u90e8\u662f\u5176\u8c03\u7528\u7684\u7ec4\u4ef6,\u7b49\u7b49,\u76f4\u5230 TCP\/IP \u90e8\u5206\u3002\u6ce8\u610f\u6b64\u9009\u9879 \u53ef\u80fd\u9700\u8981\u5f88\u957f\u65f6\u95f4,\u5982\u679c\u6ca1\u6709\u8db3\u591f\u6743\u9650\u53ef\u80fd\u5931\u8d25\u3002<\/p>\n -e \u663e\u793a\u4ee5\u592a\u7f51\u7edf\u8ba1\u4fe1\u606f\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -s\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002<\/p>\n -n \u4ee5\u6570\u5b57\u5f62\u5f0f\u663e\u793a\u5730\u5740\u548c\u7aef\u53e3\u53f7\u3002<\/p>\n -o \u663e\u793a\u4e0e\u6bcf\u4e2a\u8fde\u63a5\u76f8\u5173\u7684\u6240\u5c5e\u8fdb\u7a0b ID\u3002<\/p>\n -p<\/p>\n proto \u663e\u793a proto \u6307\u5b9a\u7684\u534f\u8bae\u7684\u8fde\u63a5;proto \u53ef\u4ee5\u662f\u4e0b\u5217\u534f\u8bae\u4e4b\u4e00: TCP\u3001UDP\u3001TCPv6 \u6216<\/p>\n UDPv6\u3002 \u5982\u679c\u4e0e -s \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u4ee5\u663e\u793a\u6309\u534f\u8bae\u7edf\u8ba1\u4fe1\u606f,proto \u53ef\u4ee5\u662f\u4e0b\u5217\u534f\u8bae\u4e4b\u4e00:<\/p>\n IP\u3001IPv6\u3001ICMP\u3001ICMPv6\u3001TCP\u3001TCPv6\u3001UDP \u6216 UDPv6\u3002<\/p>\n -r \u663e\u793a\u8def\u7531\u8868\u3002<\/p>\n -s \u663e\u793a\u6309\u534f\u8bae\u7edf\u8ba1\u4fe1\u606f\u3002\u9ed8\u8ba4\u5730,\u663e\u793a IP\u3001IPv6\u3001ICMP\u3001ICMPv6\u3001TCP\u3001TCPv6\u3001UDP \u548c UDPv6 \u7684\u7edf\u8ba1\u4fe1\u606f;<\/p>\n -p \u9009\u9879\u7528\u4e8e\u6307\u5b9a\u9ed8\u8ba4\u60c5\u51b5\u7684\u5b50\u96c6\u3002<\/p>\n -v \u4e0e -b \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u65f6\u5c06\u663e\u793a\u5305\u542b\u4e8e \u4e3a\u6240\u6709\u53ef\u6267\u884c\u7ec4\u4ef6\u521b\u5efa\u8fde\u63a5\u6216\u76d1\u542c\u7aef\u53e3\u7684\u7ec4\u4ef6\u3002<\/p>\n interval \u91cd\u65b0\u663e\u793a\u9009\u5b9a\u7edf\u8ba1\u4fe1\u606f,\u6bcf\u6b21\u663e\u793a\u4e4b\u95f4 \u6682\u505c\u65f6\u95f4\u95f4\u9694(\u4ee5\u79d2\u8ba1)\u3002\u6309 CTRL+C \u505c\u6b62\u91cd\u65b0 \u663e\u793a\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u7701\u7565,netstat \u663e\u793a\u5f53\u524d \u914d\u7f6e\u4fe1\u606f(\u53ea\u663e\u793a\u4e00\u6b21)<\/p>\n 6\u3001\u4e00\u6b21\u6027\u7684\u6e05\u9664\u5360\u752880\u7aef\u53e3\u7684\u7a0b\u5e8f<\/b><\/p>\n lsof -i :80|grep -v \"PID\"|awk {print \"kill -9\",$2}|sh<\/p>\n 7\u3001\u624b\u5de5\u7ec8\u6b62\u8fdb\u7a0b\u7684\u8fd0\u884c<\/b><\/p>\n kill 5014<\/p>\n \u5982\u679c\u7ec8\u6b62\u4e0d\u4e86<\/span>,\u53ef\u4ee5\u5f3a\u5236\u7ec8\u6b62<\/p>\n kill -9 5014<\/p>\n lsof -i:80<\/p>\n \u603b\u7ed3<\/span>:Linux\u4e0b\u7aef\u53e3\u88ab\u5360\u7528\u95ee\u9898\u89e3\u51b3\u529e\u6cd5<\/p>\n 1.\u786e\u8ba4\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528:netstat -tln 9704(\u88ab\u5360\u7528\u7aef\u53e3\u53f7)<\/p>\n 2.\u67e5\u770b\u8be5\u7aef\u53e3\u88ab\u54ea\u4e2a\u8fdb\u7a0b\u5360\u7528:lsof -i 9704(\u88ab\u5360\u7528\u7aef\u53e3\u53f7)<\/p>\n 3.\u786e\u8ba4\u6ca1\u6709\u95ee\u9898\u4e4b\u540e,\u6740!kill -9 pid(\u5360\u7528\u8be5\u7aef\u53e3\u7684\u8fdb\u7a0bid)<\/p>\n","protected":false},"excerpt":{"rendered":" \u4e00\u3001\u5728windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d,\u67e5\u8be2\u7aef\u53e3\u5360\u7528\u548c\u6e05\u9664\u7aef\u53e3\u5360\u7528\u7684\u7a0b\u5e8f 1\u3001\u67e5\u8be2\u7aef\u53e3\u5360\u7528\u7684\u8fdb\u7a0bID \u70b9\u51fb\"\u5f00\u59cb\"-- […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[1651,1650,1652],"class_list":["post-5133","post","type-post","status-publish","format-standard","hentry","category-wljs","tag-linux","tag-windows","tag-1652"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/5133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=5133"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/5133\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=5133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=5133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=5133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}