how to open a port in ubuntu server code example Example 1: ubuntu open port sudo ufw allow 1191/tcp Example 2: see what is using a port ubuntu $ sudo lsof -i:22