List guest machine names from command prompt

Madhavan Kumar asked:

How to list the names of all guest machines from the command line using,

virt-install

Something like, virt-install list-vms will do?

My answer:


You mean virsh list which will list all running VMs?

# virsh list
 Id    Name                           State
----------------------------------------------------
 2     IPA_DC2                        running
 3     test                           running

Or virsh list --all which shows running and shutoff VMs?

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     IPA_DC2                        running
 3     test                           running
 -     Archlinux                      shut off
 -     Buildbox-EL6                   shut off
 -     c5                             shut off
 -     c6                             shut off
 -     c7                             shut off
 -     CentOS7                        shut off
 -     Debian7                        shut off
 -     Fedora-QEMU-A9-armhfp-20-1-sda shut off
 -     fedora20-ppc64                 shut off
 -     FreeSWITCH                     shut off
 -     OpenStack_Juno                 shut off
 -     Puppet                         shut off
 -     Ubuntu1204                     shut off
 -     Windows2008R2                  shut off
 -     Windows2012R2                  shut off
 -     Windows_8_1                    shut off
 -     WindowsXP                      shut off

See also man virsh for every option.

Or use the virt-manager GUI to manage your VMs.

virt-manager GUI


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.