Courtesy of 3 quick ways to reduce your attack surface on Linux, a command to identify open ports and identify the associated application:
$ ss -tulnp --no-header | awk '{print($1, $5, $7)}' udp 0.0.0.0:32770 users:(("vlc",pid=2786557,fd=39)) udp 0.0.0.0:32771 users:(("vlc",pid=2786557,fd=40)) udp 127.0.0.1:123 udp 0.0.0.0:123 udp 0.0.0.0:631 udp 0.0.0.0:37019 udp 0.0.0.0:5353 udp 0.0.0.0:39276 users:(("vlc",pid=2786557,fd=50)) udp 0.0.0.0:39277 users:(("vlc",pid=2786557,fd=51)) tcp 0.0.0.0:61209 tcp 127.0.0.1:25 tcp 127.0.0.1:5433 tcp 0.0.0.0:8794 tcp 127.0.0.1:3493 tcp 127.0.0.1:5101 users:(("ssh",pid=899751,fd=4)) tcp 127.0.0.1:5102 users:(("ssh",pid=2187130,fd=4)) tcp 127.0.0.1:5201 users:(("ssh",pid=2186389,fd=5)) tcp 127.0.0.1:5202 users:(("ssh",pid=2186389,fd=7)) tcp 0.0.0.0:22 tcp 127.0.0.1:631 tcp 127.0.0.1:5432 ...