Open and Close ports on Ubuntu for VNC

Does anyone know how to list the open ports in the BBB flashed with Ubuntu in the emmc? Then turn on or off a port?

Thanks

Bill