Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the PID of a process that uses a port on Windows

Tags:

port

My service crash on startup with the classic:

java.rmi.server.ExportException: Listen failed on port: 9999 

How can I find the process for killing it?

like image 568
Thomas Avatar asked Apr 11 '13 15:04

Thomas


People also ask

How do I find the PID of a port in Windows?

Open a CMD prompt. Type in the command: netstat -ano -p tcp. You'll get an output similar to this one. Look-out for the TCP port in the Local Address list and note the corresponding PID number.

How do I find the PID of a process in Windows?

Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort.

What is the process ID PID for TCP port 3389?

In our case, the TCP port 3389 is used by a process whose process ID (PID) is 1272.


1 Answers

Just open a command shell and type (saying your port is 123456):

netstat -a -n -o | find "123456" 

You will see everything you need.

The headers are:

 Proto  Local Address          Foreign Address        State           PID  TCP    0.0.0.0:37             0.0.0.0:0              LISTENING       1111 
like image 189
Thomas Avatar answered Oct 10 '22 00:10

Thomas