在Windows平台下如何查看某个端口被谁占用
C:\Users\yourname>netstat -ano
アクティブな接続
プロトコル ローカル アドレス 外部アドレス 状態 PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 596
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 3052
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:1024 0.0.0.0:0 LISTENING 5660
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 8148
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 1028
TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING 740
TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING 1056
TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING 604
TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING 2128
TCP 0.0.0.0:49669 0.0.0.0:0 LISTENING 904
TCP 0.0.0.0:49700 0.0.0.0:0 LISTENING 888
TCP 0.0.0.0:49705 0.0.0.0:0 LISTENING 904
TCP 0.0.0.0:49712 0.0.0.0:0 LISTENING 2896
TCP 0.0.0.0:49713 0.0.0.0:0 LISTENING 2896
TCP 192.168.137.108:139 0.0.0.0:0 LISTENING 4
TCP 192.168.137.108:52516 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52517 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52518 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52519 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52520 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52521 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52522 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:52583 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52593 202.107.117.23:995 TIME_WAIT 0
TCP 192.168.137.108:52595 192.168.1.11:8014 CLOSE_WAIT 2896
TCP 192.168.137.108:52598 192.168.2.78:8080 TIME_WAIT 0
TCP 192.168.137.108:52599 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52600 192.168.2.78:8080 TIME_WAIT 0
TCP 192.168.137.108:52601 192.168.2.78:8080 TIME_WAIT 0
TCP 192.168.137.108:52604 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52605 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52609 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52610 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52611 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52612 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52613 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52614 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52615 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52616 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52617 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52618 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52619 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52620 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52621 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52623 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52624 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52625 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52626 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52627 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52628 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52629 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52630 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52631 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52632 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52633 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52651 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52652 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52653 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52654 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52655 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52656 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52657 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52658 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52659 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52660 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52661 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52662 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52663 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52664 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52665 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52666 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52667 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52668 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52669 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52670 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52671 52.80.214.187:80 SYN_SENT 4584
TCP 192.168.137.108:52672 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52674 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52675 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52676 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52677 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52678 192.168.71.95:8080 TIME_WAIT 0
TCP 192.168.137.108:52679 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52680 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52681 192.168.71.95:8080 CLOSE_WAIT 16800
TCP 192.168.137.108:52683 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52684 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52685 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52686 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52692 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52693 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52694 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52695 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52697 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52699 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52700 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52702 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52703 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52704 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52705 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52706 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52710 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52711 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:52713 192.168.71.95:8080 ESTABLISHED 16800
TCP 192.168.137.108:53383 192.168.71.95:8080 CLOSE_WAIT 8876
TCP 192.168.137.108:55884 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 192.168.137.108:57314 192.168.71.95:8080 ESTABLISHED 6168
TCP 192.168.137.108:57635 192.168.71.95:8080 CLOSE_WAIT 6692
TCP 192.168.137.108:58552 192.168.71.95:8080 CLOSE_WAIT 15972
TCP 192.168.137.108:58553 192.168.71.95:8080 CLOSE_WAIT 15972
TCP 192.168.137.108:58554 192.168.71.95:8080 CLOSE_WAIT 15972
TCP 192.168.137.108:58637 10.10.135.159:3389 ESTABLISHED 12904
TCP 192.168.137.108:58965 192.168.71.95:8080 CLOSE_WAIT 9732
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING 4584
TCP 127.0.0.1:21440 0.0.0.0:0 LISTENING 2480
TCP 127.0.0.1:21441 0.0.0.0:0 LISTENING 2480
TCP 192.168.25.1:139 0.0.0.0:0 LISTENING 4
TCP 192.168.239.1:139 0.0.0.0:0 LISTENING 4
TCP [::]:135 [::]:0 LISTENING 596
TCP [::]:443 [::]:0 LISTENING 3052
TCP [::]:445 [::]:0 LISTENING 4
TCP [::]:3389 [::]:0 LISTENING 1028
TCP [::]:49664 [::]:0 LISTENING 740
TCP [::]:49665 [::]:0 LISTENING 1056
TCP [::]:49666 [::]:0 LISTENING 604
TCP [::]:49668 [::]:0 LISTENING 2128
TCP [::]:49669 [::]:0 LISTENING 904
TCP [::]:49700 [::]:0 LISTENING 888
TCP [::]:49705 [::]:0 LISTENING 904
TCP [::]:49713 [::]:0 LISTENING 2896
UDP 0.0.0.0:123 *:* 1064
UDP 0.0.0.0:500 *:* 604
UDP 0.0.0.0:957 *:* 4
UDP 0.0.0.0:3389 *:* 1028
UDP 0.0.0.0:4500 *:* 604
UDP 0.0.0.0:5050 *:* 1064
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 1028
UDP 0.0.0.0:5353 *:* 16800
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5353 *:* 8808
UDP 0.0.0.0:5355 *:* 1028
UDP 0.0.0.0:52879 *:* 12904
UDP 192.168.137.108:137 *:* 4
UDP 192.168.137.108:138 *:* 4
UDP 192.168.137.108:1900 *:* 5160
UDP 192.168.137.108:56264 *:* 5160
UDP 127.0.0.1:1900 *:* 5160
UDP 127.0.0.1:50801 *:* 16804
UDP 127.0.0.1:52613 *:* 1028
UDP 127.0.0.1:54094 *:* 904
UDP 127.0.0.1:55983 *:* 604
UDP 127.0.0.1:56267 *:* 5160
UDP 192.168.25.1:137 *:* 4
UDP 192.168.25.1:138 *:* 4
UDP 192.168.25.1:1900 *:* 5160
UDP 192.168.25.1:56266 *:* 5160
UDP 192.168.239.1:137 *:* 4
UDP 192.168.239.1:138 *:* 4
UDP 192.168.239.1:1900 *:* 5160
UDP 192.168.239.1:56265 *:* 5160
UDP [::]:123 *:* 1064
UDP [::]:500 *:* 604
UDP [::]:960 *:* 4
UDP [::]:3389 *:* 1028
UDP [::]:4500 *:* 604
UDP [::]:5353 *:* 16800
UDP [::]:5353 *:* 8808
UDP [::]:5353 *:* 8808
UDP [::]:5353 *:* 8808
UDP [::]:5353 *:* 16800
UDP [::]:5353 *:* 16800
UDP [::]:5353 *:* 1028
UDP [::]:5355 *:* 1028
UDP [::1]:1900 *:* 5160
UDP [::1]:56263 *:* 5160
UDP [fe80::1d51:c1f1:570b:f8b9%4]:1900 *:* 5160
UDP [fe80::1d51:c1f1:570b:f8b9%4]:56260 *:* 5160
UDP [fe80::98b4:a87f:2fa5:1961%8]:1900 *:* 5160
UDP [fe80::98b4:a87f:2fa5:1961%8]:56261 *:* 5160
UDP [fe80::b1be:2d4e:ed3c:5086%5]:1900 *:* 5160
UDP [fe80::b1be:2d4e:ed3c:5086%5]:56262 *:* 5160
C:\Users\yourname>netstat -ano |findstr "3052"
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 3052
TCP [::]:443 [::]:0 LISTENING 3052
C:\Users\yourname>tasklist|findstr "3052"
VisualSVNServer.exe 3052 Services 0 632 K
1,调出cmd 命令:win+R
2,输入命令:netstat -ano,列出所有端口的情况
3,输入命令:netstat -ano | findstr "8080" 查看8080端口的PID码,是最后面的那数字 3104
4,输入命令:tasklist | findstr "3104"
5,终于找到是INSLSNR.EXE惹的祸,杀死它,输入命令:taskkill /f /t /im INSLSNR.EXE
------------------------------------------------------------------------------------------------------------------
linux 查看端口号:
netstat -ltunp