Introduction to Netstat
Netstat is a tool to determine the TCP connections are active on the machine where the command is enabled and thus list all the ports TCP and UDP open on the computer.
The command “netstat” also provides statistics on a number of protocols (Ethernet, IPv4, TCP, UDP, ICMP and IPv6).
Settings netstat
Used without any arguments, the netstat command displays all connections opened by the machine. The netstat command has a number of optional parameters; its syntax is as follows:
netstat [-a] [-e] [-n] [-o] [-s] [-p proto] [-r] [interval]
Used with the -a, netstat shows all connections and listening ports on the machine.
Used with the -e, the netstat command displays statistics Ethernet .
Used with the -n, the netstat command displays addresses and port numbers in numeric format, without name resolution.
Used with the -o netstat details the process number associated with the connection.
Used with the -p flag of the protocol (TCP, UDP or IP), netstat displays the information requested on the specified protocol.
Used with the -r argument, the command netstat displays routing table.
Used with the -s argument, the netstat command displays detailed statistics by protocol.
Finally an optional interval to determine the refresh information in seconds. By default this parameter is 1 second.