Virsh Command Builder

Build virsh commands for KVM and libvirt. Manage local or remote VMs, lifecycle, CPU, memory, console, XML, saved state, media, and deletion safely.

Advertisement

Frequently Asked Questions

What is virsh?+

virsh is the primary command-line interface for libvirt. It manages virtual machine domains and related libvirt resources, most commonly QEMU/KVM guests on Linux.

What is the difference between qemu:///system and qemu:///session?+

qemu:///system connects to the system-wide libvirt daemon and is the normal choice for servers, shared storage, bridges, and administrator-managed VMs. qemu:///session manages VMs owned by the current user and has more limited access to system networking and storage.

Does virsh shutdown immediately power off a VM?+

No. virsh shutdown sends a clean shutdown request to the guest and returns before the shutdown necessarily finishes. Use virsh domstate to check progress. virsh destroy is the immediate power-off equivalent and risks data loss.

What do --live and --config mean?+

--live changes the currently running VM. --config changes the persistent definition used at the next boot. Supplying both requests the change now and after future starts, when the selected operation and hypervisor support both.

How do I connect to a remote KVM host?+

Use a libvirt SSH URI such as virsh --connect qemu+ssh://admin@kvm-host.example.com/system list --all. SSH key authentication is recommended, and the remote account must be authorized to access the system libvirt daemon.

Why does virsh console show a blank screen?+

The VM needs a serial device and the guest operating system must be configured to use a serial console. For many Linux guests that means enabling a ttyS0 console in the kernel command line and starting a serial getty. Press Ctrl+] to leave virsh console.

Does virsh undefine delete VM disks?+

Not by default. virsh undefine removes the persistent domain definition while preserving storage. Adding --remove-all-storage tells libvirt to delete managed volumes too and should be treated as irreversible.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.