Linux Logo

Command to Check if Linux is Running in VMware or not

Only having terminal access to a server running CentOS 5.7, I had to determine if the server was actually a physical or virtual machine. There are a few methods to do this, however, here are a couple of the easier methods.

dmesg | fgrep Vendor\:\ VMware

Vendor: VMware Model: Virtual disk Rev: 1.0

dmesg | grep Vendor

Vendor: VMware Model: Virtual disk Rev: 1.0

dmesg | grep -i vendor

Vendor: VMware Model: Virtual disk Rev: 1.0

dmesg | grep VMware

DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/22/2008
hda: VMware Virutal IDE CDROM Drive, ATAPI CD/DVD-ROM drive
Vendor: VMware Model: Virtual disk Rev: 1.0

lspci | grep VMware

00:0f.0 VGA compatible controller: VMware SVGA II Adapter

rpm -qa | grep vmw

xorg-x11-drv-vmware-10.13.0-2.1

rpm -qa | grep vm

xorg-x11-drv-vmware-10.13.0-2.1
xorg-x11-drv-vmouse-12.4.0-2.1
and others…

About the Commands
dmesg
(for “display message” or “driver message” ) is a command on most Linux and Unix based operating systems that prints the message buffer of the kernel.

lspci is used to display information about PCI buses and devices connected to them.

fgrep means fixed-string grep and is the same as grep -F

grep will search files for lines that match a given pattern.

Sources
http://communities.vmware.com/thread/52192
http://en.wikipedia.org/wiki/Dmesg
http://linux.die.net/man/8/lspci
http://ss64.com/bash/fgrep.html
http://communities.vmware.com/thread/177691