(from Tutorials and videos)
Open a Terminal window.
On Fedora and Debian you will need to become root. Type the following command and, when prompted, your root password:
Then you can list all the virtual machines:
virsh list --all
On Ubuntu, you should use
sudo to run the command
as root instead:
sudo virsh list --all
When you run the command you should see a listing like this:
Id Name State ---------------------------------- 3 FedoraRawhide running - Debian shut off
The three columns are:
Id: A unique number given to running virtual machines.
Name: The name of the VM, which you specified when it was created.
State: The state which is
shut offfor VMs that are switched off, and various other states for running and paused VMs.
Other virt tools commands can use either the
Id or the
Name to refer to the virtual machine. For example
these two commands are equivalent ways to show the console:
virt-viewer 3 virt-viewer FedoraRawhide
virsh list displays an error, then try
searching for the error or contacting us.
For QEMU, KVM, and remote connections, ensure that the
libvirtd service is running.
Many errors are obvious from the error message, for example:
error: no connection driver available for xen:/// error: failed to connect to the hypervisor
would mean that the Xen hypervisor is not running on the local machine.
virsh list --all runs but displays nothing, it
--all flag lists all virtual machines, which
includes ones which are currently running and ones which are
switched off. If you omit this flag then only running virtual
machines are shown.
Another useful flag is
-c which can be used to
select the hypervisor. This can be used if you are running
two hypervisors on one machine (eg. Xen and QEMU guests),
or if you are not root and want to connect to the system
hypervisor, or to connect to a remote server running libvirtd.
-r flag to connect read-only to the hypervisor.
This is useful to perform operations while not requiring the
For example, if you are not root and want to list QEMU and KVM guests without needing the root password you could do:
virsh -r -c qemu:///system list --all
This libvirt documentation describes remote connections in detail.