Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 9 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
3  
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

 
discard

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.