LinuxCommandLibrary

virsh

Libvirt virtualization management CLI

TLDR

List running VMs

$ virsh list
copy
List all VMs
$ virsh list --all
copy
Start VM
$ virsh start [vm-name]
copy
Shutdown VM
$ virsh shutdown [vm-name]
copy
Force stop VM
$ virsh destroy [vm-name]
copy
Connect to console
$ virsh console [vm-name]
copy
Show VM info
$ virsh dominfo [vm-name]
copy
Define VM from XML
$ virsh define [vm.xml]
copy

SYNOPSIS

virsh [-c uri] command [args]

DESCRIPTION

virsh is the command-line interface for managing virtual machines through the libvirt virtualization API. It provides unified control over KVM, QEMU, Xen, and other hypervisors, handling domain lifecycle operations, storage pools, virtual networks, and snapshots.
Domains (VMs) can be started, stopped, paused, and migrated. The console command provides serial access to running VMs (exit with Ctrl+]). Domain configurations are defined in XML and can be created, modified, and exported. The tool also manages storage pools, volumes, and virtual networks for complete virtualization infrastructure control.

PARAMETERS

list

List domains.
start NAME
Start domain.
shutdown NAME
Graceful shutdown.
destroy NAME
Force stop.
console NAME
Serial console.
dominfo NAME
Domain info.
define XML
Define domain.
undefine NAME
Remove domain.
-c URI
Connection URI.

CAVEATS

Requires libvirt daemon. Root for system VMs. XML syntax complex.

HISTORY

virsh is the command-line interface for libvirt, the virtualization API. It provides unified management for multiple hypervisors.

SEE ALSO

virt-manager(1), qemu(1), kvm(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community