Search code examples
bashvirtualizationkvmxenopenvz

Detect virtualization in bash


One of my commands in my bash script will depend on the virtualization of the server (XEN or OpenVZ or KVM ). How can I check which of these is in use in bash?


Solution

  • I found a small shell script that is able to detect virtualization and it handles Xen,OpenVZ,KVM,Parallels, Vmware and many more

    virt-what

    Installation with yum is pretty straight forward

    Here is the output on my system

    $ virt-what
    kvm