Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

This question already has an answer here:

I am running a web server on a machine with Ubuntu 11. Everything is accessible from the local network, but not from outside. What can I do to check to make sure the appropriate ports are open?

I am relatively new to Ubuntu and server management, so any "dumbing down" is just fine.

Appreciate any help. Google search hasn't given me much actionable advice.

share|improve this question

marked as duplicate by Kevin Bowen, Eric Carvalho, Basharat Sialvi, Raja, bcbc Aug 5 '13 at 6:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

This sounds more like a question about how to configure/test your router instead of an Ubuntu question? – JanC Nov 5 '11 at 19:01
Technically they are slightly different are this question asks which ports are open in the firewall and the other questions asks which ports are open and have processes listening on them – Ciaran Liedeman Nov 5 '11 at 19:34
I did see that post. Did not seem to relate to what I'm trying to accomplish. – agent47 Nov 5 '11 at 22:30

I've always used this:

netstat -ntlp | grep LISTEN
share|improve this answer
You're a freaking genius. – user973810 Jun 20 '14 at 14:02

This is enough to show that there is a process listening on IP address (needed so it will reply to any request) on port 80 (standard web server port number). In my case this shows it is the web server lighttpd

$ sudo netstat -ntlp | grep :80
tcp        0      0    *               LISTEN          2495/lighttpd

If you later want to make sure that the only thing you allow through your firewall is port 80 I often use ShieldsUp from to perform a firewall test.

share|improve this answer

sudo iptables -L will list the port rules for your pc. Note that if you are using ufw or shorewall firewalls the output maybe be hard to read. In that case rather use sudo ufw status for example.

This is not very useful on its own as even if a port is open access will still be denied if there is no process listening on that port.

share|improve this answer

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