I prefer using a gui when controlling my virtual machines. Learning how to control them in the most basic way from the command line or terminal is easy. It is very self explanatory once you know about the virsh command. I have made some examples below on how to use these commands.
Here is the list of basic commands to start, stop and reboot your virtual machines.
List your running guests
virsh list
[sourcecode language=”text”]
Id Name State
—————————————————-
2 apt-cacher.home running
[/sourcecode]
List all guests:
virsh list –all
[sourcecode language=”text”]
Id Name State
—————————————————-
2 apt-cacher.home running
– db1.home shut off
– db2.home shut off
– devlab.home shut off
– minecraft.home shut off
– vault.home shut off
– web.home shut off
[/sourcecode]
To start a vm
we can only use their vm name to start them.
virsh start db1.home
To reboot a vm
We can use name or id to reboot the vm.
virsh reboot 2
virsh reboot apt-cacher.home
To stop or shutdown a vm
virsh shutdown 2
virsh shutdown apt-cacher.home
To shutdown or stop an unresponsive or crashed vm
virsh destroy 2
virsh destroy apt-cacher.home
To get information about your vm
virsh dominfo 2
virsh dominfo apt-cacher.home
[sourcecode language=”text”]
Id: 2
Name: apt-cacher.home
UUID: f194bb17-5f0e-21f5-f712-8a98edd4f1d8
OS Type: hvm
State: running
CPU(s): 1
CPU time: 332.8s
Max memory: 262144 KiB
Used memory: 262144 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: apparmor
Security DOI: 0
Security label: libvirt-f194bb17-5f0e-21f5-f712-8a98edd4f1d8 (enforcing)
[/sourcecode]
Happy controlling!