Shared server guidance · Question & answer

How do I identify the Windows process using a local TCP port?

Use Get-NetTCPConnection to find the local listener and its owning process ID. This is useful when an SSH tunnel cannot bind its chosen local port. Identify the application before deciding whether any process should be stopped.

IntermediateLocal Windows PowerShell with NetTCPIP
Go to the answer

Instructions

1. Inspect the specific local port

Port 8080 is an example for a local tunnel or test application.

Local Windows PowerShell
Get-NetTCPConnection -State Listen -LocalPort 8080 | Select-Object LocalAddress, LocalPort, OwningProcess

Check whether the listener binds to loopback, a particular interface or every interface.

2. Look up the reported process ID

Use the actual PID returned by the previous command, not a value copied from another computer.

Local Windows PowerShell
Get-Process -Id 1234 | Select-Object Id, ProcessName, Path

Replace 1234 with the observed PID. Some process details require administrative access.

3. Resolve the conflict narrowly

For an SSH tunnel, select another unused local port if permitted. If the existing application should be stopped, use its normal authorised shutdown mechanism. Do not terminate an unknown process merely because it occupies the desired port.

Check the result

  • The process identity corresponds to the observed port listener.
  • The intended tunnel or application can bind its approved local port.

Troubleshooting

No listener is found
The conflict may be transient, use another address family, or involve a reserved port range.
The process details are inaccessible
Use an authorised elevated diagnostic session if necessary; do not change permissions on system processes.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.