Netstat

July 2015

Introduction to Netstat

Netstat is a tool for identifying which TCP connections are active on the machine where the command is run, listing all TCP and UDP ports that are open on that computer.

The command "netstat" is also used to retrieve statistics on a number of protocols (Ethernet, IPv4, TCP, UDP, ICMP and IPv6).

Netstat command settings

When used with no arguments, the command netstat displays all connections which have been opened by the machine. The command netstat has a number of optional settings. The syntax is:

netstat [-a] [-e] [-n] [-o] [-s] [-p PROTO] [-r] [interval]

When used with the argument -a, the command netstat displays all connections and listening ports on the machine.

When used with the argument -e, the command netstat displays Ethernet statistics.

When used with the argument -n, the command netstat displays the address and port numbers in numerical form, without name lookup.

When used with the argument -o, the command netstat gives the number of the process assigned to the connection.

When used with the argument -p followed by the name of the protocol (TCP, UDP or IP), the command netstat displays the requested information concerning the specified protocol.

When used with the argument -r, the command netstat displays the routing table.

When used with the argument -s, the command netstat displays detailed statistics for each protocol.

Finally, an optional refresh interval (given as a number of seconds) can be used to set how long to display the information before reloading it. By default, it is set to 1 second.

For unlimited offline reading, you can download this article for free in PDF format:
Netstat .pdf

See also


Netstat
Netstat
Netstat
Netstat
Netstat
Netstat
netstat
netstat
Netstat
Netstat
This document entitled « Netstat » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.