Name

virsh

Synopsis

virsh [options] [command [command-options]]

libvirt management interface. virsh uses the libvirt API to connect to a hypervisor and manipulate the configuration and state of virtual machines controlled by that hypervisor. If invoked with a command, it will execute the command and then exit. If invoked without a command, virsh enters a shell mode from which you can execute commands.

This manager will work with any hypervisor that has libvirt support. However, not all virsh commands are supported by all hypervisors. Nor will they work on all guests. Still, if a hypervisor can do something, you can generally use virsh to do it. Some hypervisors, including Xen, come with their own tools for managing virtual machines, but we still recommend you use virsh instead.

Most virsh commands expect a domain option. A domain refers to a virtual machine. You can use the virtual machine’s name or UUID. If the machine is running, it should also have an ID number within the hypervisor, and you can use this for the domain option as well. Use the list command to see names and IDs of domains managed by the hypervisor.

Options

--c uri, --connect=uri

Connect to a hypervisor specified by uri.

-d level, --debug=level

Set the level of debugging information to be printed to standard output. Accepted values are 0–5. 0 disables debugging messages and is the default. 5 prints all debugging messages.

-h, --help

Print a brief description of options and commands.

-l file, --log=file

Log debugging information ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.