Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

Thanks, Alex

share|improve this question
up vote 16 down vote accepted

"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.

share|improve this answer
I think both is best ;) – Genadinik Apr 19 '11 at 17:57
What was a little strange is that I have tomcat and apache servers running and neither port 8080 nor 80 showed up in the list. Would you know why that would happen? – Genadinik Apr 19 '11 at 18:02
@Genadinik Verify what port they are configured to listen on; for Apache this is the Listen directive in its config file, but I don't know about Tomcat. – Kromey Apr 19 '11 at 18:06
fuser -n tcp 8080 will approach it from the other end; showing you which process (if any) is listening on TCP port 8080. – SmallClanger Apr 19 '11 at 18:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.