端口使用情況

windows

1. netstat -ano                              列出所有端口的情況
2. netstat -aon|findstr "49157"        查看被佔用端口對應的PID
3. tasklist|findstr "2720"                 根據PID查找對應的進程 或者 打開任務管理器,切換到進程選項卡,在PID一列查看2720對應的進程是誰
4. taskkill /f /t /im xxx.exe             殺死進程

linux

lsof -i:端口號                                查看端口號佔用
netstat -tunlp | grep 端口號            用於顯示 tcp,udp 的端口和進程等相關情況
kill -9 PID                                    殺死進程

 


參考:
https://www.runoob.com/w3cnote/linux-check-port-usage.html
https://jingyan.baidu.com/article/3c48dd34491d47e10be358b8.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章