To list all the KVM virtual machine (VM) guests on a Linux system using the virsh
command, you can use the following command:
virsh list --all
This will list all the VMs on the system, including running VMs and VMs that are in a shut-off or paused state. The output will show the ID, name, and state of each VM.
You can also use the --uuid
option to list the UUIDs of the VMs instead of their names:
virsh list --uuid
To list only the running VMs, use the --state-running
option:
virsh list --state-running
And to list only the VMs that are in a shut-off or paused state, use the --state-shutoff
or --state-paused
option, respectively.
virsh list --state-shutoff virsh list --state-paused
For more information on the virsh list
command and its options, you can refer to the virsh
man page or the documentation for your version of libvirt.