Linux Network Tools - netstat


netstat is a command line tool that can list out all network (socket) connections on a system: TCP, UDP and Unix socket connections.routing tables, interface statistics, masquerade connections and multicast memberships.

List all connections

netstat -a

List TCP connections

netstat -at

List UDP connections

netstat -au

List listening connections

netstat -l

Disable reverse DNS lookup

netstat will try to find the hostname of each IP address by doing a reverse DNS lookup. This is slow.

netstat -n

List Process Name/ID

It is useful to know what process is using particular port.

netstat -p

Display Routing Table

Routing tables are used to compute the path of a packet. It is stores routes to network destinations and contains the topology of the network. Routing protocols and static routes help calculate the routing table.

netstat -nr
netstat -atnp | grep ESTA
network -i

Slightly more readable

network -ie
netstat -s

Continuous output

netstat -c