lkill port code example

Example 1: kill port

lsof -i:8080

Example 2: kill service by port number on windows

taskkill /F /PID PORT_NUMBER

Example 3: stop a process running on a port

# Print PID of process bound on that port.
fuser 8080/tcp

# Kill that process
fuser -k 8080/tcp

Example 4: kill process on port

#list process running on specified port (here 80, change to your port)
sudo lsof -i:80

#kill process on specified port (here 80, change to your port)
sudo kill $(sudo lsof -t -i:80)

Example 5: kill port

:8080.
C:\Users\psmith>netstat -ano|findstr "PID :8080"
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 18264

taskkill /pid 18264 /f