Check Port UsageTo check network connections, routing tables, interface statistics, masquerade connections, and multicast memberships with process ids. As root, run netstat with options -vatpun, see more in man netstat.
netstat -vatpun |||||| |||||+-- show numerical address (ip #). ||||+--- show udp protocol. |||+---- show pid and name of program to which each socket belongs. ||+----- show tcp protocol. |+------ show both listening and non-listening sockets. +------- verbose.
# netstat -vatpun Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 5196/hpiod tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 5284/mysqld tcp 0 0 0.0.0.0:6543 0.0.0.0:* LISTEN 5836/mythbackend tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 4783/portmap tcp 0 0 0.0.0.0:6544 0.0.0.0:* LISTEN 5836/mythbackend tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN 5669/inetd tcp 0 0 127.0.0.1:44305 0.0.0.0:* LISTEN 5199/python tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 5446/cupsd tcp 0 0 0.0.0.0:51065 0.0.0.0:* LISTEN 5754/rpc.statd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 5634/exim4 tcp 0 0 192.168.15.131:45421 74.125.93.101:80 ESTABLISHED6383/firefox-bin tcp 0 0 192.168.15.131:55256 64.233.169.103:80 ESTABLISHED6383/firefox-bin tcp 0 0 192.168.15.131:45859 64.233.169.106:80 ESTABLISHED6383/firefox-bin udp 0 0 0.0.0.0:32768 0.0.0.0:* 5546/avahi-daemon: udp 0 0 0.0.0.0:32769 0.0.0.0:* 5754/rpc.statd udp 0 0 0.0.0.0:68 0.0.0.0:* 5679/dhclient udp 0 0 0.0.0.0:842 0.0.0.0:* 5754/rpc.statd udp 0 0 0.0.0.0:5353 0.0.0.0:* 5546/avahi-daemon: udp 0 0 0.0.0.0:111 0.0.0.0:* 4783/portmap udp 0 0 0.0.0.0:631 0.0.0.0:* 5446/cupsd