You are here

virsh cheat sheet

i am currently working with kvm a little bit, so as usual i tried to figure out the command line version instead of relying on virt-manager. this is great since, virt-manager is not guaranteed to work across the network without a little setup. source is taken from here

Command 

Description 

virsh list --all

Show a list of all the defined guests

virsh dominfo guest's_name

Show a guest’s info

virsh start guest's_name

Start a guest

virsh shutdown guest's_name

Shutdown a guest (gently via acpi)

virsh destroy guest's_name

Shutdown a guest (force)

virsh suspend guest's_name

Suspend a guest

virsh resume guest's_name

Resume a suspended guest

virsh create xml_file.xml

Create a guest from its XML definition

virsh dumpxml guest's_name

Dump a guest’s definition in XML

virsh edit guest's_name

Modify a guest’s definition

virsh undefine guest's_name

Remove a guest’s definition (it doesn’t remove the image file)

virsh undefine guest's_name --remove-all-storage

Remove a guest’s definition and all the associatied storage

virsh save guest's_name guest's_state_file

Save a guest’s state on a file

virsh restore guest's_state_file

Restore a guest from a state file

virsh console guest's_name

open a CLI console to the guest (installed OS must support it)

virt-viewer guest's_name

Open a vnc console to the guest

if you got any more to add to the cheat sheet, write a comment and i will add it

Comments

virsh is the interface to libvirt