How to check which ports are being used by which process
sudo netstat -tulpn
How to check for a specific port
The lsof
(list open files) command can also be used to find the processes using a port:
sudo lsof -i :<port number>
How to enable a port in a firewall
sudo ufw allow <port number>
sudo ufw reload
sudo ufw allow out <port number>
How to check which ports are open in the firewall