From a Linux OS, is there a way to determine if the OS is running as a guest OS on a virtualized VMware environment as opposed to running directly on non-virtualized/bare metal/physical host? In my case it is either VMware or not, but I am also interested the more general question of whether the OS is on physical hardware or virtualized hardware of any sort.
In VMware:
In Virtualbox same command outputs
VirtualBox
On newer systems, the command "lscpu" give's you the information you need, inclusive which hypervisor the VM is running on.
You can look at the output of the following:
Any of these will print various things that should point to if and what virtualisation-platform is being used.