When working with Linux servers—whether for deployment, development, or system administration—you may wonder if your system is running on a physical machine or a virtual machine (VM).
With virtualization technologies like KVM, VMware, VirtualBox, and QEMU, many Linux systems are deployed on virtual machines rather than bare-metal servers.
This guide shows you how to check if Linux is running on a physical machine or a VM using simple commands.
1. Check with dmidecode
#
The easiest way to distinguish between a VM and a physical server is by using the dmidecode command, which reads the system’s DMI (Desktop Management Interface) table.
Run:
sudo dmidecode -s system-manufacturer
- On a physical machine, you’ll see the manufacturer name (e.g., Dell, Lenovo, HP).
- On a virtual machine, you’ll see entries like
QEMU
,innotek Gmbh
(VirtualBox), orVMware
.
Example on physical hardware:
$ sudo dmidecode -s system-manufacturer
Dell Inc.
Example on a VM:
$ sudo dmidecode -s system-manufacturer
QEMU
👉 The dmidecode
command is very useful because it reveals hardware-related details such as manufacturer, serial number, and system model.
2. Use the virt-what
Utility
#
Another reliable method is to use the virt-what tool, a small shell script that detects virtualization technologies.
Install virt-what
#
On Ubuntu/Debian:
sudo apt install virt-what
On CentOS/RHEL:
sudo yum install virt-what
Run the command #
virt-what
- If the system is running on a physical machine, it will return nothing.
- If it’s running inside a virtual machine, it will output the virtualization type:
$ virt-what
kvm
3. Other Useful Checks #
-
Check Linux Kernel Version (software info):
uname -a
This shows kernel and system info, but not hardware type.
-
Check CPU info (hints of virtualization):
lscpu | grep Hypervisor
If you see a Hypervisor vendor, the system is virtualized.
✅ Conclusion #
Now you know how to check if Linux is running on a virtual machine or a physical machine.
- Use
dmidecode
to get manufacturer details. - Use
virt-what
to quickly detect virtualization technology. - For extra confirmation, check CPU info with
lscpu
.
These methods are essential for system administrators who need to confirm the environment before performing hardware-sensitive configurations or optimizations.
🔎 Related Search Keywords for SEO:
- check if Linux is virtual or physical
- Linux detect virtualization KVM VMware VirtualBox
- Linux dmidecode virtualization
- how to know if Linux is running on VM