virt-what(1) — shell command

Are you running on bare metal — or inside a virtual machine?

virt-what is a small shell script that answers exactly that question. This site explains the command and collects the open-source projects that make virtualization happen.

root@guest:~
$ 

NAME

virt-whatdetect if we are running in a virtual machine

DESCRIPTION

virt-what is a shell script written by Richard W.M. Jones, maintained as part of the libguestfs tool family. Run inside a guest, it prints one or more facts describing the virtualization technology it detects — one per line — and prints nothing at all on bare metal.

Detection is based on low-level evidence: CPUID hypervisor leaves, DMI/SMBIOS strings, devices typical for a given hypervisor, and files under /proc and /sys. Because some of these sources are only readable by root, the script should be run with root privileges — otherwise results may be incomplete.

kvmLinux KVM — used by Proxmox VE, libvirt, OpenStack and most Linux hosts
vmwareVMware ESXi / Workstation guest
hypervMicrosoft Hyper-V (also the basis of many Azure VMs)
xen / xen-hvmXen guest, paravirtualized or fully virtualized
lxcLinux container (LXC / Incus system container)
(no output)No virtualization detected — physical hardware

Typical use: in Ansible facts, kickstart/cloud-init scripts or monitoring checks, where behavior should differ between physical and virtual machines.

OPEN-SOURCE VIRTUALIZATION

A curated, non-exhaustive list of open-source projects across the stack — from hypervisor to management platform.

KVM

Hypervisor

Kernel-based Virtual Machine: the type-1 hypervisor built into the Linux kernel. The foundation almost every Linux virtualization platform builds on.

linux-kvm.org

QEMU

Emulator / VMM

Machine emulator and virtualizer. Together with KVM it provides full hardware virtualization; on its own it can emulate foreign CPU architectures (x86 ↔ ARM, RISC-V …).

qemu.org

libvirt

API / Tooling

Uniform management API and daemon for KVM/QEMU, Xen, LXC and more. The layer behind virsh, virt-manager and many higher-level platforms.

libvirt.org

Proxmox VE

Platform

Complete virtualization platform on Debian: KVM VMs plus LXC containers, clustering, HA, software-defined storage (ZFS, Ceph) and backups behind one web UI.

proxmox.com

Incus

Platform

Community-driven fork of LXD: manages system containers and KVM virtual machines with one consistent CLI and REST API. Image-based, cluster-capable, lightweight.

linuxcontainers.org/incus

Xen Project

Hypervisor

Veteran type-1 hypervisor with a strong isolation model (dom0/domU). Powers Qubes OS and parts of large cloud infrastructure.

xenproject.org

LXC

Container

Linux system containers: OS-level virtualization using namespaces and cgroups. Feels like a VM, shares the host kernel — the technology behind Proxmox containers and Incus.

linuxcontainers.org

Firecracker

MicroVM

Minimal VMM in Rust, built by AWS for Lambda/Fargate. Boots stripped-down microVMs in milliseconds — strong isolation with container-like density.

firecracker-microvm.github.io

Cloud Hypervisor

MicroVM

Modern Rust VMM under the Linux Foundation, focused on cloud workloads: minimal device model, virtio, strong security posture.

cloudhypervisor.org

KubeVirt

Kubernetes

Runs classic virtual machines as Kubernetes resources — VMs and containers side by side in the same cluster, managed with kubectl.

kubevirt.io

Harvester

HCI

Hyper-converged infrastructure by SUSE/Rancher: KubeVirt + Longhorn storage on Kubernetes, packaged as an installable appliance.

harvesterhci.io

VirtualBox

Desktop

Cross-platform type-2 hypervisor for the desktop (GPLv3 base package). Handy for quickly trying out operating systems on Linux, Windows and macOS.

virtualbox.org

COMMANDS WORTH KNOWING

A handful of commands every virtualization admin reaches for sooner or later.

sudo virt-what

Prints the detected virtualization facts, e.g. kvm. No output means bare metal. Run as root for complete results.

systemd-detect-virt

The systemd alternative — present on virtually every modern distro. Returns e.g. kvm, lxc or none; --container and --vm narrow the check. Exit code 0 means “virtualized”, ideal for shell scripts.

lscpu | grep -i virtualization

On a host: shows whether the CPU offers hardware virtualization (VT-x / AMD-V). In a guest it shows the hypervisor vendor instead.

sudo dmidecode -s system-product-name

Reads the SMBIOS product string — virtual machines reveal themselves here with values like KVM, VMware Virtual Platform or Virtual Machine.

virsh list --all

libvirt's CLI: lists all defined VMs including stopped ones. virsh start, virsh shutdown and virsh console cover day-to-day operations.

qemu-img convert -O qcow2 disk.vmdk disk.qcow2

Converts disk images between formats (vmdk, vdi, raw, qcow2) — the standard move when migrating VMs from VMware or VirtualBox to KVM.

qm list  &&  pct list

On a Proxmox VE node: qm manages KVM VMs, pct manages LXC containers — start, stop, config, migrate, all scriptable.

incus launch images:debian/13 web1

Creates and starts a Debian 13 system container in seconds. Add --vm and Incus launches a real KVM virtual machine from the same image server.