ubuntu list port using code example Example 1: see what is using a port ubuntu $ sudo lsof -i:22 Example 2: ubuntu open all port sudo ufw allow 1:9999/tcp