System or Network administrators looks ports and applications to solve problems. Getting port and application info in Linux can be done lsof command. But in Windows?
netstat is a very popular and useful tool used to get network and port-related information.
List Listening Port with netstat Command
We will use
netstat command like below in order to list which process, application or service listening which port on Windows.
- -a Display all connections and listening ports
- -b Display port and connection related executable/application
- -n Display port numbers as a number, not port name
- -o Display process/executable owner
C:\> netstat -a -b
What is that? it says we need Administrator privileges. Open command prompt with Administrator privileges
From the output following information is provided
- The protocol is the transport layer protocol like TCP or UDP
- Local Address is the current local system IP address.
0.0.0.0means every IP address current system have. Because the current system may have multiple interfaces and IP addresses.
- Foreign Address is the remote system address or Hostname which is connected or waiting
- State specifies the given port status like LISTENIN, CLOSED, CONNECTED etc.