How to Install and Use netstat
etstat lists sockets and connections. On recent Ubuntu the recommended tool is ss (from iproute2); both show which ports are open.
Steps
Install net-tools (netstat) if you need it; ss is usually already there:
sudo apt updatesudo apt install -y net-tools iproute2TCP/UDP listeners with netstat: