20.15. Displaying the IP Address and Port Number for the VNC Display

The virsh vncdisplay command returns the IP address and port number of the VNC display for the specified guest virtual machine. If the information is unavailable for the guest, the exit code 1 is displayed.
Note that for this command to work, VNC has to be specified as a graphics type in the devices element of the guest's XML file. For further information, see Section 23.18.12, “Graphical Framebuffers”.

Example 20.37. How to display the IP address and port number for VNC

The following example displays the port number for the VNC display of the guest1 virtual machine:
virsh vncdisplay guest1
127.0.0.1:0