August 8th, 2007
To check if a port is currently in use on a Windows machine, and then get some clue as to what’s using it, run the netstat program from a command console.
- Start > Run
- Enter cmd
- In the command console enter:
netstat -ano|grep portNumber
This lists any processes where the port number is included somewhere on the line.
- Look at the first number (in the second column). If this shows the port number after a colon, this means the port is currently being used.
- Make a note of the number at the end of the line. This is the process ID (PID).
- Run the ps program and grep for this PID:
ps -ef|grep PID
Here I was checking what was using port 4485.
C:\Documents and Settings\Administrator>netstat -ano|grep 4485
TCP 22.214.171.124:4485 126.96.36.199:80 CLOSE_WAIT 2444
C:\Documents and Settings\Administrator>ps -ef|grep 2444
Administrator 2444 – - Aug 02 - 0:16 GoogleDesktopIndex 3 5
It turned out GoogleDesktopIndex was using that port.