RHCSA – virsh and virt-manager


By the end of this article you should be able to answer the following questions:


You can find all my latest posts on medium.

What is the command to enter the vm managing's interactive shell?

$ virsh
virsh #

What is the command to list all VMs?

$ virsh
virsh # list –all

What is the command to list only running VMs?

$ virsh
virsh # list

How can you make it easier to using this interactive shell?

tab+tab technique

What is the command to start a vm called 'puppetmaster'?

$ virsh
virsh # start puppetmaster

What is the command to shutdown the vm called 'puppetmaster'?

$ virsh
virsh # destroy puppetmaster

Which directory houses each vm's xml config file?


What is the command to start the gui for managing VMs?

$ virt-manager

What is the command to edit an existing vm called 'puppetmaster'?

virsh # edit puppetmaster

What is the command?

virsh is it’s own virtual interactive shell which is triggered by simply running the virsh command:

$ virsh
Welcome to virsh, the virtualisation interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # quit


Tip: When inside a virsh session, use tab+tab technique to autocomplete as much as you can to make life easier.

Here’s how to list all your vm’s (both running and switched off):

virsh # list --all
 Id    Name                           State

If you just want to view a list of vms that are currently running, then simply omit the “-all” flag and do:

virsh # list
 Id    Name                           State

To start a vm, do:

virsh # start {machine-name}

To stop a machine do:

virsh # destroy {machine-name}

This doesn’t actually delete the vm, it only powers it down, and hence can be started up again later.

The entire configuration of a vm is stored as an xml file, which is named after the vm’s name, and these xml config files are all stored in the following directory:


If you want to make changes to one of these xml files, the you should do it via the virsh command like this:

virsh # edit {machine-name}

That is so that libvirt doesn’t edit the xml config file at the same time as you are editing it.


virt-manager is a gui tool that let’s you create/manage/destroy vms. It’s similar to the way virtualbox is used.

You can start virt-manager GUI like this:

$ virt-manager