How to check whether a machine is virtual machine?
--
$ hostnamectl status
if the output shows "Chassis: vm" , it is virtual machine.
For physical machine it shows something like "Chassis: laptop"
--
Another command to try
$ systemd-detect-virt
--
source:
https://www.ostechnix.com/check-linux-system-physical-virtual-machine/