Ports

Find and Kill a Process

2021-10-09. Category & Tags: Windows, Linux, Commands, Networking, Ports

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'

ref 1 & ref 2

Windows #

CMD find PID by port & kill by PID:

:: find pid first:
netstat -ano | findstr :8080
:: then the pid's task/process
tasklist | findstr "<the_PID>"
taskkill /PID <the_PID> /F

PS find for TCP & UDP:

...