1. 程式人生 > >Windows和Linux檢視端口占用

Windows和Linux檢視端口占用

Windows方法

TCP

netstat -aon|findstr "TCP"|findstr "LISTENING"|findstr ":135[^0123456789]"

UDP

netstat -aon|findstr "UDP"|findstr ":5353[^0123456789]"

最後面的數字為PID

接下來只要在tasklist裡找PID一樣的程式就行了

tasklist|findstr

Linux方法

lsof -i -P -n|grep -v ESTABLISHED