Opening and Closing Ports on Whonix

Hi, I have read wiki article about ports but I didn’t find the answers I was looking for. I would like to know the following:

  1. How to check which ports are open?
  2. Can I open a port (or all ports) for some applications and keep it closed for the rest?
  3. How to check which port(s) is a specific application listening on?
  4. How to close a port (or all ports)?

Whonix wont give a lecture on networking, but you can startup with reading and watching tutorials about the usage of wireshark and common linux tools and commands for networking (many explaining that if you use the search engine).

Unspecific to Whonix. → Potential Solutions Beyond Whonix!

Can be resolved as per Self Support First Policy for Whonix.

Yes.

Yes.

Close: Only by configuring the application not to open the port.

Filter (block): Using firewall.