Linux determines whether the current machine is a virtual machine or a physical machine

dmidecode -s system-product-name
VMware Virtual Platform //Include the word virtual, which is a virtual machine

dmidecode -s system-product-name
PowerEdge R730 //does not contain the word virtual, it is a physical machine

Use the dmesg command to view (root privileges)
dmesg|grep -i dmi:
DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/14/2014 //Include the word "virtual", which is a virtual machine

dmesg|grep -i dmi:
[0.000000] DMI: Dell Inc. PowerEdge R730/04N3DF, BIOS 2.5.5 [OEM 1.0.0] 09/27/2017 // does not contain the word virtual, it is a physical machine

Guess you like

Origin blog.csdn.net/qq_34939308/article/details/112324844