DEV Community

gie3d
gie3d

Posted on

Stop a service running on a specified port

Windows

netstat -ano | findstr "PID: <port>"
Enter fullscreen mode Exit fullscreen mode

Then use taskkill

taskkill /pid <pid> /f
Enter fullscreen mode Exit fullscreen mode

Unix

netstat -vanp tcp | grep <port>
Enter fullscreen mode Exit fullscreen mode

Then use kill

sudo kill -9 <pid>
Enter fullscreen mode Exit fullscreen mode

Discussion (0)