Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

20.5. Displaying Information about a Guest Virtual Machine and the Hypervisor

The virsh list command will list guest virtual machines connected to your hypervisor that fit the search parameter requested. The output of the command has 3 columns in a table. Each guest virtual machine is listed with its ID, name, and state.
A wide variety of search parameters is available for virsh list. These options are available on the man page, by running man virsh or by running the virsh list --help command.

Note

Note that this if this command only displays guest virtual machines created by the root user. If it does not display a virtual machine you know you have created, it is probable you did not create the virtual machine as root.
Guests created using the virt-manager interface are by default created by root.

Example 20.1. How to list all locally connected virtual machines

The following example lists all the virtual machines your hypervisor is connected to. Note that this command lists both persistent and transient virtual machines.
# virsh list --all

Id              Name                      State
------------------------------------------------
8		guest1			running
22		guest2			paused
35		guest3			shut off
38              guest4			shut off

Example 20.2. How to list the inactive guest virtual machines

The following example lists guests that are currently inactive, or not running. Note that the list only contains persistent virtual machines.
# virsh list --inactive

Id              Name                      State
------------------------------------------------
35		guest3			shut off
38		guest4			shut off
In addition, the following commands can also be used to display basic information about the hypervisor:
  • # virsh hostname - displays the hypervisor's host name, for example:
    # virsh hostname
    dhcp-2-157.eus.myhost.com
    
  • # virsh sysinfo - displays the XML representation of the hypervisor's system information, if available, for example:
    # virsh sysinfo
    <sysinfo type='smbios'>
      <bios>
        <entry name='vendor'>LENOVO</entry>
        <entry name='version'>GJET71WW (2.21 )</entry>
    [...]