Netstat
Updated: January 21, 2005
Syntax
Parameters
Remarks
- Parameters used with this command must be prefixed with a hyphen (- ) rather than a slash (/).
-
Netstat provides statistics for the following:
- Proto
The name of the protocol (TCP or UDP).
- Local Address
The IP address of the local computer and the port number being used. The name of the local computer that corresponds to the IP address and the name of the port is shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).
- Foreign Address
The IP address and port number of the remote computer to which the socket is connected. The names that corresponds to the IP address and the port are shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).
- (state)
Indicates the state of a TCP connection. The possible states are as follows:
CLOSE_WAIT
CLOSED
ESTABLISHED
FIN_WAIT_1
FIN_WAIT_2
LAST_ACK
LISTEN
SYN_RECEIVED
SYN_SEND
TIMED_WAIT
For more information about the states of a TCP connection, see RFC 793.
- Proto
-
This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.
Examples
netstat -e -s
To display the statistics for only the TCP and UDP protocols, type:
netstat -s -p tcp udp
To display active TCP connections and the process IDs every 5 seconds, type:
netstat -o 5
To display active TCP connections and the process IDs using numerical form, type:
netstat -n -o
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |