, ,

Netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics.

Useful for showing stats on interfaces, what programs are listening on which interfaces.

Example use:

netstat -tap

(t)TCP connections only, (a)all connections, (p)show process name that’s using the connection.

If you have lots of output you can combine the command with grep to just show what you’re interested in:

netstat -tap | grep mysql

Will just show the connections opened by mysql

Netstat wiki page