HostOnNet Blog

virsh

virsh is used to manage virtual machines using libvirt.

To list all running vm run,

virsh list

Example

boby@hon-pc-01:~$ virsh list
 Id    Name                           State
----------------------------------------------------
 1     kali                           running

boby@hon-pc-01:~$ 

List all Virtual Machines

“virsh list –all” command will list all virtual machines including that are shut off.

boby@hon-pc-01:~$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     kali                           running
 -     win7                           shut off

boby@hon-pc-01:~$ 

Start a VM

virsh start VMID command is used to start a VM

boby@hon-pc-01:~$ virsh start kali
Domain kali started

boby@hon-pc-01:~$

Shutdown a Virtual Machine

virsh shutdown command can be used to shutdown a VM

boby@hon-pc-01:~$ virsh shutdown 1
Domain 1 is being shutdown

boby@hon-pc-01:~$ 

Posted in Virtualization