Basic Format
netstat [options]Key Options
-a | Displays all active connections and the TCP and UDP ports on which the computer is listening. |
|
-n | Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names. |
|
-p [protocol] | Shows the PID and name of the program to which each socket belongs. |
|
-r | Displays the routing table. |
|
-t | Displays TCP connections. |
|
-u | Displays UDP connections. |
|
-e | Displays additional network interface information in a table format, including the number of bytes and packets sent and received. |
|
-s | Displays statistics by protocol. |
Examples
netstat -tulnp | Lists all active listening TCP and UDP connections with numerical addresses, along with their PID and program names. |
|
netstat -an | grep ':80 ' | Displays all active connections on port 80 (commonly used for HTTP), showing IP addresses and ports as numbers. |
|
netstat -rn | Shows the system's routing table with numerical addresses, giving a quick overview of how the traffic is routed. |
|
netstat -s -p tcp | Displays detailed TCP protocol statistics. |
|
netstat -ie | Displays information about the network interfaces, including IP addresses, MAC addresses, and traffic statistics. |