List Open Ports

To list the open ports together with the listening processes:

netstat -tulpn

Here is an example output:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      695/sshd        
tcp6       0      0 :::22                   :::*                    LISTEN      695/sshd        
udp        0      0 0.0.0.0:55872           0.0.0.0:*                           407/avahi-daemon: r
udp        0      0 0.0.0.0:68              0.0.0.0:*                           694/dhcpcd      
udp        0      0 10.7.0.70:123           0.0.0.0:*                           722/ntpd        
udp        0      0 127.0.0.1:123           0.0.0.0:*                           722/ntpd        
udp        0      0 0.0.0.0:123             0.0.0.0:*                           722/ntpd        
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           407/avahi-daemon: r
udp6       0      0 :::546                  :::*                                694/dhcpcd      
udp6       0      0 fe80::a9be:bf0c:367:123 :::*                                722/ntpd        
udp6       0      0 2a02:810d:19c0:7748:123 :::*                                722/ntpd        
udp6       0      0 ::1:123                 :::*                                722/ntpd        
udp6       0      0 :::123                  :::*                                722/ntpd        
udp6       0      0 :::5353                 :::*                                407/avahi-daemon: r
udp6       0      0 :::51486                :::*                                407/avahi-daemon: r