Netstat Command
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.
It is used for finding problems in the network and to determine the amount of traffic on the network as a performance measurement. It can also be used to find the open / listening ports on your system.
Using Netstat
Display all active TCP connections and the TCP and UDP ports on which the computer is listening.
$ netstat -a
Show only listening sockets (TCP and UDP)
$ netstat -l
Display open ports and established TCP connections
$ netstat -vatn
Same for UDP connections
$ netstat -vaun
-n option shows the numeric address. If you want to see the Fully Qualified Domain Name (FQDN) addresses instead, omit the option n from the above commands.
Display a table of all network interfaces
$ netstat -i
Display a table of kernel routing tables
$ netstat -r
Netstat is a cross platform tool and is available for Windows, Linux and Mac OS X.