Find and Kill a Process
2021 - 10 - 09
see also: 鸟哥 Linux 私房菜 Basic Linux.
Linux
find bound PID by port: fuser 8080/tcp
kill by port: fuser -k 8080/tcp
list by port: lsof -i:8080
using netstat: netstat -nlpte |grep :8080
or: ss -nlpt 'sport = :8080'
Windows
CMD find & kill by PID:
netstat -ano | findstr :8080
taskkill /PID <the_PID> /F
PS find for TCP & UDP:
Get-Process -Id (Get-NetTCPConnection -LocalPort <port_number>).OwningProcess
Get-Process -Id (Get-NetUDPEndpoint -LocalPort <port_number>).OwningProcess