Ubuntu: Get ports being used (with associated applications)
by admin on Aug.11, 2010, under Linux (Ubuntu)
Here’s a simple command that will display all ports being currently used. It will let you view all active connections, as well as all applications listening to a port right now.
lsof -i
Another way of only getting the used ports (without further details) :
netstat -anp --tcp --udp | grep LISTEN