kill process port 8080 linux code example

Example 1: kill app at port

#To list any process listening to the port 8080:
lsof -i:8080

#To kill any process listening to the port 8080:
kill $(lsof -t -i:8080)

#or more violently:
kill -9 $(lsof -t -i:8080)

Example 2: kill the process running on 8080

C:\Users\RevisitClass>netstat -ano | findstr 8080
  TCP    0.0.0.0:18080          0.0.0.0:0              LISTENING       19788
  TCP    [::]:18080             [::]:0                 LISTENING       19788

Example 3: kill linux port

sudo fuser -k 1883/tcp

Example 4: 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

Example 5: kill a process at a port

fuser -k 8080/tcp

Example 6: kill the process running on 8080

C:\Users\RevisitClass>taskkill /F /PID 19788
SUCCESS: The process with PID 19788 has been terminated.

Tags:

Misc Example