kvm-logoKVM (Qemu) virtualization comes with a batch of useful basic command line tools to administer virtual machines without having to use the graphical VM manager.

Note that these commands require root privileges to be used.

To view the list of all virtual machines present on the system, use

virsh list --all

Using this command will return a list similar to the one below:

This lists both running and offline VMs. Excluding the --all parameter will only list running machines.

Another useful command is the one to start a virtual machine:
virsh start Guest
“Guest” being the VM name as is displayed in the list above.

A running machine may at times need to be stopped or restarted:

virsh reboot Guest

virsh shutdown Guest

Using these commands is just like the virtual power button, and it may open a dialog inside the VM. If a guest won’t shut down or reboot, it is usually caused by a problem with ACPI and/or guest configuration.

If you expect for a VM to respond to reboot/shutdown and they don’t, you may need to destroy guests that don’t respond to ordinary events.

virsh destroy Guest

Be careful as the guest is switched off (similar to unplugging the power cord) with no warning and no chance to save data to disks.

Leave a Reply