

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:4077 errors:0 dropped:0 overruns:0 carrier:0 RX packets:4486 errors:0 dropped:0 overruns:0 frame:0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 # netstat -ieĮth0 Link encap:Ethernet HWaddr 00:0C:29:B4:DA:21 Showing Kernel interface table, similar to ifconfig command. Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg Showing network interface packet transactions including both transferring and receiving packets with MTU size. # netstat -rĭestination Gateway Genmask Flags MSS Window irtt Ifaceĭefault 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 14. Displaying Kernel IP routingĭisplay Kernel IP routing table with netstat and route command. The default screen refreshes every second. Displaying Promiscuous Modeĭisplaying Promiscuous mode with -ac switch, netstat print the selected information or refresh screen every five seconds. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name # netstat -tpĪctive Internet connections (w/o servers) Displaying Service name with PIDĭisplaying service name with their PID number, using option netstat -tp will display “ PID/Program Name“. Showing Statistics by UDP Protocol # netstat -suĢ968722 packets sent 11. Showing statistics of only TCP protocol by using option netstat -st. The -s parameter can be used to specify a set of protocols. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols. Showing Statistics by Protocolĭisplays statistics by protocol. Unix 2 STREAM LISTENING 5531 /var/run/m 8. Unix 2 STREAM LISTENING 6216 2 STREAM LISTENING 5517 /var/run/acpid.socket Unix 2 STREAM LISTENING 5136 /var/run/dbus/system_bus_socket Unix 2 STREAM LISTENING 4645 /var/run/audispd_events Unix 2 STREAM LISTENING 4157 2 STREAM LISTENING 60835836 /var/lib/mysql/mysql.sock Unix 2 STREAM LISTENING 6175 /var/run/avahi-daemon/socket Unix 2 STREAM LISTENING 6215 2 STREAM LISTENING 6038 /tmp/.font-unix/fs7100 Unix 2 STREAM LISTENING 7082 2 STREAM LISTENING 6157 /dev/gpmctl Unix 2 STREAM LISTENING 4171 2 STREAM LISTENING 5767 /var/run/cups/cups.sock Listing all active UNIX listening ports using netstat -lx. Listing all active listening UDP ports by using option netstat -lu. Tcp 0 0 localhost.localdomain:smtp *:* LISTEN Tcp 0 0 localhost.localdomain:ipp *:* LISTEN

Listing all active listening TCP ports by using option netstat -lt. # netstat -lĪctive Internet connections (only servers)Īctive UNIX domain sockets (only servers) Listing all active listening ports connections with netstat -l. Listing only UDP ( User Datagram Protocol ) port connections using netstat -au.

Listing only TCP ( Transmission Control Protocol) port connections using netstat -at. Proto RefCnt Flags Type State I-Node Path Tcp 0 52 192.168.0.2:ssh 192.168.0.1:egs ESTABLISHEDĪctive UNIX domain sockets (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State # netstat -a | moreĪctive Internet connections (servers and established) Listing all ports (both TCP and UDP) using netstat -a option. Listing all the LISTENING Ports of TCP and UDP Connections This article shows usages of netstat command with their examples which may be useful in daily operation.
