Sunday, March 15, 2020

Kill a process running on a port

While working on a web application in GO i faced issue of open ports for a Rest API call and did not close it smoothly. I wasn't able to use the same port again as was being used by an application already, so to overcome this problem I had to kill the process.

1. Open CMD with admin access (Run as Administrator) and run the netstat command as follows

netstat -ano



here
-a  => displays all port in use
-n  => stops hostname lookups (Time consuming task)
-o  => list the process ID

Now from the above list you can identify the process ID and kill.


2. Kill the process forcefully

taskkill /pid 13784 /f


/pid  => process id switch
/f     => kills the process forcefully


You can also perform the same action from the task manager as well.

No comments:

Post a Comment