How can we check whether the machine is a physical or virtual one in Linux?
Which command can be used?
How can we check whether the machine is a physical or virtual one in Linux?
Which command can be used?
If you've got systemd installed, it comes with systemd-detect-virt.
me@real-machine:~$ systemd-detect-virt
none
me@vm:~$ systemd-detect-virt
qemu
Can detect many different types of virtualization and containers, too.
If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).
See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.
Using lshw will give you system information:
sudo apt-get install lshw
sudo lshw -class system Similar question in serverfault:
VMware Linux Server — how can you tell if you are a vm or real hardware?
And my answer :-)