Netstat Command In Linux
Chapter:
Linux Commands
Last Updated:
13-08-2019 12:47:05 UTC
Program:
/* ............... START ............... */
/* netstat -r used to get kernel routing information. */
$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default _gateway 0.0.0.0 UG 0 0 0 eth0
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
/* netstat -i Show the list of network interfaces */
$ netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 194689 0 0 0 75486 0 0 0 BMRU
lo 65536 194 0 0 0 194 0 0 0 LRU
/* ............... END ............... */
Output
Notes:
-
Linux netstat is a command-line tool that displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
- netstat -r is the commonly used command to get the kernel routing information.
- netstat -a will show both listening and non-listening sockets.
- netstat -au command will show all UDP ports.
- netstat -at will provide the active TCP connection port.
- netstat -l is used to list only the listening ports.
- netstat -lt is used to list only the listening tcp ports.
- netstat -s linux command list the statistics for all ports.