Lifecycle Management

$ sudo systemctl start libvirtd  # start virtualization service
$ virsh list --all               # list all VMs
$ virsh start <vm-name>          # launch a VM
$ virsh reboot <vm-name>         # reboot a VM
$ virsh shutdown <vm-name>       # gracefully stop a VM
$ virsh destroy <vm-name>        # forcibly stop a VM
$ virsh suspend <vm-name>        # pause a VM
$ virsh resume <vm-name>         # resume a paused VM
$ virsh undefine <vm-name> [--remove-all-storage --delete-storage-volume-snapshots]  # delete a VM

Connection & Access

$ virt-viewer --connect qemu:///session <vm-name>  # connect to a VM via GUI
$ virsh console <vm-name>  # connect to a VM via serial console
$ ssh <username>@<vm-ip>   # connect to a VM via SSH

Volume (Disk) Management

$ virsh detach-disk <vm-name> vdX [--persistent] [--live]  # detach a disk
$ virsh attach-disk <vm-name> <path-to-image> vdX [--persistent] [--live]  # attach a disk to the VM, where vdX is the disk name
$ virsh vol-list --pool default  # list all images in the pool default
$ virsh vol-delete <vol-name> --pool <pool-name>  # delete a volume, where <vol-name> can be obtained by vol-list
$ virsh vol-create-as <pool-name> <vol-name> <size>  # create a volume. example size: 20G
$ qemu-img resize <path-to-image> +20G  # add 20GiB to the disk

Memory Management

$ virsh setmaxmem <vm-name> <max-mem>  # set max memory
$ virsh setmem <vm-name> <mem_capacity> [--config]  # set the actual memory that can be used. Cannot exceed max memory, add --config to make it persistent

Snapshot Management

$ virsh snapshot-list <vm-name>  # list all snapshots
$ virst snapshot-create-as <vm-name> <snapshot-name> --description <comment>
$ virsh snapshot-info <vm-name> <snapshot-name>    # get info about snapshot
$ virsh snapshot-revert <vm-name> <snapshot-name>  #  revert to a snapshot

Hardware Configuration

$ virsh dominfo <vm-name>     # get detail info about vm
$ virsh domblklist <vm-name>  # list VM storage info
$ virsh domblkinfo <vm-name> <path-to-img>  # get disk info
$ virsh domifaddr <vm-name>   # list VM network interface

Network Management

$ virsh net-list --all  # list all (user-mode) networks (add sudo for all)

GUI Manager

$ virt-manager [ --connect qemu:///session ]  # include the optional if you need to manage user-mode VMs. By deafault it's qemu:///system 

Misc

$ virsh edit <vm-name>  # edit VM's XML config file
$ virsh info <vm-name>  # gether the detailed info of VM

To be continued...