Sometimes it is useful to find what ports a machine is listening to. Here are some use cases:
Display listening ports
$ netstat -l
Display listening ports with numeric address/port values
$ netstat -nl
Display listening tcp ports
Use -t for tcp
$ netstat -nlt
Display listening udp ports
Use -u for udp
$ netstat -nlu
Display IP v6 ports
Use -6 for IP v6
$ netstat -nl -6
Display IP v4 ports
Use -4 for IP v4
$ netstat -nl -4