[CentOS] How to detect whether running on VMware?

Ned Slider ned at unixmail.co.uk
Thu Jul 24 12:14:59 UTC 2008

Marc-Andre Levesque wrote:
> -----Original Message-----
> From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Tony Mountifield
>> Does anyone know how a program, script or shell user can best determine
>> whether the machine is running on bare metal or is a VMware guest?
>> Cheers
>> Tony
> This script does the trick for me on ESX 3 by looking at the (virtual) hardware description. But it probably is not foolproof.
> if ( `/sbin/lspci | grep -qi vmware` ) || \
>    ( `grep -qi vmware /proc/scsi/scsi` ); then
>     echo "This is a Virtual Machine."
> Fi
> Marc-Andre

Alternatively, grep the output from dmidecode for VMware:

dmidecode | grep VMware

You'll get output from VMware Server, I've not tested with other VMware 

More information about the CentOS mailing list