Managing virtual machines via the command line
In this chapter, I showed you how to manage VMs with virt-manager
. This is great if you have a secondary machine with a GUI running Linux as its operating system. But what do you do if such a machine isn't available, and you'd like to perform simple tasks such as rebooting a VM or checking to see which VMs are running on the server?
On the VM server itself, you have access to the virsh
suite of commands, which will allow you to manage VMs even if a GUI isn't available. To use these commands, simply connect to the machine that stores your VMs via SSH. What follows are some easy examples to get you started. Here's the first one:
virsh list
This command will return an output like that shown in the following screenshot:
Figure 16.20: Showing running VMs with the virsh list command
With one command, we were able to list the VMs running on the server. In the example screenshot, you can see...