Linux list a KVM vm guest using virsh command

You can use the virsh command to list virtual machines (VMs) managed by the libvirt virtualization library on a Linux system. The virsh list command is used to list the VMs that are currently running on the system.

To list all KVM guests that are currently running, you can use the following command:

virsh list --all

This command will show the following columns:

  • ID: the guest’s unique identifier
  • Name: the guest’s name
  • State: the guest’s current state

For example:

# virsh list --all
Id Name State
----------------------------------------------------

1 centos7 running
2 ubuntu18 shut off

You can also use the virsh dominfo command to get detailed information about a specific guest.

For example, to get information about a guest named “myguest”:

virsh dominfo myguest

It will return information like state, CPU, memory, and more.

Additionally, you can use virsh list --inactive command to list all inactive VMs. Please note that to run these commands you need to have superuser privilege.

(Zolpidem)

Leave a Comment