Currently I'm trying to setup my ssl in docker instance. I'm trying to check if these ports are allowed in my firewall

Port: 443 and 4021

I've searched that allowing specific port for firewall using this terminal command

sudo ufw allow 4021

But how can I check and see all the ports allowed in my firewall?

3 Answers 3


All you have to do is ufw status


If you configure all your firewall setting with ufw, then ufw status would show you the ports. But sometimes (in my experience) this doesn't show all configured firewall ports and options.

You would get a general output with: iptables -L -v -n

-L = list all ports
-v = make the output verbose
-n = do print port numbers instead of servicenames (otherwise it would print "http" or "ssh" instead of "80" or "22".

The command is faster when using the -n option an also can be `grep`ped or `ack`ed (https://beyondgrep.com/) for the port number
  • something like sudo ufw -L? but this gives list of commands such as enable, disabled, default arg and so on
    – Pablo
    Nov 26, 2019 at 1:40
  • what do you mean? like @itsahobby and I said: ufw status (use with sudo or with the root-account). Did you try it? it also "lists" the ports: sudo ufw status
    – MacMartin
    Nov 26, 2019 at 7:28
  • @RaeIan is it still unclear or is your question resolved?
    – MacMartin
    Dec 9, 2019 at 9:41
sudo ufw status

will show allowed ports only is firewall is runing

sudo ufw enable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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