How to check which ports are used by which processes in Linux

How to check which ports are used by which processes in Linux

Install net-tools

sudo apt-get install net-tools

Run this command

netstat -tulpn | grep LISTEN

A list of process IDs will be shown with the ports they listen to.