Updated: 9 October 2026 · Applies to: virsh from libvirt 11.3.0 on Debian 13 and libvirt 11.10.0 on AlmaLinux 10 (tested with the libvirt test driver); QEMU 11.0.3 processes tested on Alpine Linux

To list KVM virtual machines (libvirt calls them domains), run sudo virsh list --all. Plain virsh list shows only the running VMs; --all adds the ones that are shut off. Each line shows the domain ID, name and state:

$ sudo virsh list --all
 Id   Name    State
------------------------
 1    test    running
 2    db01    running
 -    web01   shut off

A shut-off VM has no ID (-). It gets a new one each time it starts, so use the name in your commands. (Our lab output comes from libvirt's built-in test driver, which always includes a VM called test; on a real KVM host the columns are the same.)

Useful virsh list options

  • virsh list: running domains only.
  • virsh list --all: running and shut-off domains.
  • virsh list --inactive: only domains that are not running.
  • virsh list --state-running, --state-paused, --state-shutoff, --state-other: filter by state.
  • virsh list --all --name: names only, one per line, handy in scripts.
  • virsh list --uuid or --id: UUIDs or IDs only.
  • virsh list --all --autostart (or --no-autostart): domains that start with the host, or not.
  • virsh list --all --title: adds the title column from each domain's XML.
  • --persistent, --transient, --with-snapshot, --without-snapshot, --with-managed-save: further filters. virsh help list shows them all.

Examples from the same lab:

$ virsh list --all --name
test
db01
web01

$ virsh list --state-shutoff
 Id   Name    State
------------------------
 -    web01   shut off

$ virsh list --all --title
 Id   Name    State      Title
----------------------------------------------
 1    test    running
 2    db01    running
 -    web01   shut off   Customer web server

The possible states are running, idle, paused, in shutdown, shut off, crashed and pmsuspended (suspended by the guest's power management), according to the virsh manual.

Details of one VM

$ virsh domstate web01
shut off

$ virsh dominfo db01
Name:           db01
State:          running
CPU(s):         2
Max memory:     4194304 KiB
Autostart:      enable

(dominfo output shortened.) To find a guest's IP address, see how to find the IP address of a KVM guest; to start or stop one, see how to start a KVM VM from the command line.

virsh list shows nothing or an error

  1. You ran it as a normal user. Without root, virsh connects to qemu:///session, your own per-user VMs, so the system VMs do not appear. Use sudo virsh list --all, or connect to the system explicitly: virsh -c qemu:///system list --all. Check where you are connected with virsh uri.
  2. The libvirt daemon is not running. On Debian 13 the error was:
    error: failed to connect to the hypervisor
    error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
    On AlmaLinux 10 it said No URI is provided and cannot identify any listening daemon socket path to attempt to connect to. Install and start the daemon:
    sudo apt install libvirt-daemon-system && sudo systemctl enable --now libvirtd   # Debian, Ubuntu
    sudo dnf install libvirt && sudo systemctl enable --now virtqemud.socket       # AlmaLinux, Rocky, RHEL
    According to libvirt, virtqemud.socket is the one to start on current RHEL-family systems. For a full KVM host setup, see how to install KVM on Debian.
  3. virsh is missing. It is in libvirt-clients on Debian and Ubuntu and in libvirt-client on AlmaLinux, Rocky Linux and RHEL.

List VMs on another KVM host

virsh can query a remote host over SSH with a libvirt URI (format from the libvirt documentation):

virsh -c qemu+ssh://root@203.0.113.10/system list --all

To make qemu:///system your default, set export LIBVIRT_DEFAULT_URI=qemu:///system in your shell profile.

QEMU: list VMs without libvirt

virsh only knows the VMs that libvirt manages. Virtual machines started by hand with qemu-system-x86_64 are ordinary processes, so list them with pgrep or ps. The -name option shows which VM is which:

$ pgrep -a qemu
21 qemu-system-x86_64 -name web01 -machine none -nodefaults -display none -daemonize
27 qemu-system-x86_64 -name db01 -machine none -nodefaults -display none -daemonize

$ ps -C qemu-system-x86_64 -o pid,etime,args
    PID     ELAPSED COMMAND
     21       00:02 qemu-system-x86_64 -name web01 -machine none -nodefaults -display none -daemonize
     27       00:02 qemu-system-x86_64 -name db01 -machine none -nodefaults -display none -daemonize

(Test VMs without a machine, only to show the listing.) Stop such a VM from its QEMU monitor or with kill PID, which ends it like pulling the power plug.

On a Ucartz KVM VPS you are inside a guest, so there are no VMs to list there. Start, stop and reboot the VPS from the client area (Virtualizor). virsh is for your own KVM host, for example on a dedicated server; see also virtual machine software for Linux.

Official documentation: virsh(1) manual.

Was this answer helpful? 0 Users Found This Useful (1 Votes)