Commonly used commands on Ubuntu Server
Enable firewall
sudo ufw enable
Check firewall status
sudo ufw status verbose
Open ports
sudo ufw allow ssh
# OR (more explicitly)
sudo ufw allow 22/tcp
# Open ports in a range
sudo ufw allow <start_port>:<end_port>/<protocol>
Delete port from firewall
sudo ufw delete allow 22/tcp # Removes the rule allowing SSH on port 22