terminate port linux code example

Example 1: kill port linux

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

Example 2: kill port

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

Example 3: kill linux port

sudo fuser -k 1883/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 a process at a port

fuser -k 8080/tcp

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