How to show listening ports and TCP connections to the ports

Try

netstat --tcp --listen --numeric-ports

Ex.

$ netstat --tcp --listen --numeric-ports
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 ::1:6010                :::*                    LISTEN     

and

netstat --tcp --numeric-ports

Ex.

$ netstat --tcp --numeric-ports
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0    272 192.168.1.11:22         192.168.1.3:43444       ESTABLISHED
tcp        0      0 192.168.1.11:22         192.168.1.2:65370       ESTABLISHED
tcp        0      0 192.168.1.11:22         192.168.1.2:65369       ESTABLISHED