sudo lsof -i -n -P | grep LISTEN
Category: Self-Hosting
sudo lsof -i -n -P | grep LISTEN
List all processes with open listening network ports — map services to ports
Lists all network-listening sockets with their process names and ports in numeric format. A complete picture of what's exposed on the network.