Step 1: Identify Unused Ports
sudo ss -tulpnStep 2: Close Port with UFW
sudo ufw deny 8080/tcp
sudo ufw reloadStep 3: Close Port with iptables
sudo iptables -A INPUT -p tcp --dport 8080 -j DROPStep 4: Stop the Associated Service
sudo systemctl stop service_name
sudo systemctl disable service_nameStep 5: Verify Port is Closed
sudo nmap -p 8080 localhost