Ubuntu – How to tell what is running on which ports in Ubuntu

portUbuntuubuntu-10.04

How could I tell what is listening on which ports on Ubuntu? In other words, how do I get a list of ports that are in use?

Best Answer

"In use" as in with an active connection, or that programs are listening on? Or both?

Run sudo netstat -lp in your terminal; this will tell you what ports are open to receive connections, and what programs are listening on them. Try sudo netstat -p for the same thing, plus currently-active connections.