kill process at port linux code example

Example 1: kill process on 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 port

kill -9 $(sudo lsof -t -i:8080)

Example 3: kill port

netstat -aon | findstr 8080
taskkill /f /pid 77777

Example 4: ubuntu kill process on a port

sudo kill -9 $(sudo lsof -t -i:4000)

Example 5: kill process on port

lsof -i:3000           // Change 3000 to whatever your port is!
sudo kill 9 <PID>      // Change <PID> to the Pid number the above command returns

Example 6: kill port

kill $(lsof -t -i:8080)