KVM command-line cheat sheet
virsh, virt-manager and brctl commands to list, start, suspend and resume KVM virtual machines on Linux.
A quick reference for the most useful commands to manage KVM/QEMU virtual machines on Linux (Debian, Ubuntu) with libvirt.
Check that KVM and QEMU are running
sudo netstat -nap | egrep '(kvm|qemu)'
Graphical tools
| Tool | Usage |
|---|---|
virt-manager |
Graphical virtual machine manager |
vncviewer 127.0.0.1:5900 |
Open the VNC console of a VM (the port depends on the VM configuration) |
Manage virtual machines with virsh
sudo virsh list --all
sudo virsh start vm01
sudo virsh shutdown vm01
sudo virsh suspend vm01
sudo virsh resume vm01
Networking: bridges
sudo brctl show
brctl is provided by the bridge-utils package and lists network bridges and their interfaces.
Notes
virsh shutdownrequests a clean shutdown of the guest;virsh destroyforces the VM to stop (it does not delete the VM).virsh stopis not a valid virsh command: useshutdownordestroyinstead.- A VNC console bound to
127.0.0.1is only reachable from the host; for remote access, use an SSH tunnel.