An interesting question. I have logged into a Linux (most likely SuSE) host. Is there some way that I can tell programmatically that I am a VM host or not?

Also assume that the vmtools are not installed.


14 Answers 14


Use standard Linux tools to inspect the hardware on the system.

cat /proc/scsi/scsi


ethtool -i eth0


dmidecode | grep -i vmware

If the output of these commands shows hardware with a manufacturer name of "VMWare", you're on a VMWare VM. Multiple commands are provided here because system configurations and tools differ.

  • 12
    Can you explain what these commands do, instead of only providing vague commands? Jun 4, 2014 at 19:33
  • Thanks. cat /proc/scsi/scsi is nice because it seems to be available everywhere and doesn't require to install new software or run with privileged rights.
    – tiktak
    Dec 16, 2014 at 12:38
  • @tiktak I don't see /proc/scsi/scsi on my Debian 7 box... Jun 8, 2015 at 15:44
  • 1
    Note that this is not 100% reliable. For instance, AWS boxes won't appear to be VMs. See man virt-what for the heuristic script built for this detection purpose (for RedHat/Fedora systems) and for the caveats involved.
    – Wildcard
    Nov 3, 2016 at 22:27
facter virtual 

indicates that it’s a VM. If it returned “physical” then the opposite is true (not a VM), eg:

facter virtual
  • However, this is a non-standard special package....but I like it.
    – mdpc
    Jan 22, 2013 at 19:36
  • 1
    @mdpc It should be present on any system using puppet. Jul 22, 2013 at 6:59

You might be able to get and idea by looking around under /sys. For example /sys/class/dmi/id/sys_vendor has a value of VMware, Inc..

If it is installed you can use lshw. The command lshw -class system returns this on my system:

    description: Computer
    product: VMware Virtual Platform
    vendor: VMware, Inc.
    version: None
    serial: VMware-...
    width: 64 bits
    capabilities: smbios-2.4 dmi-2.4 vsyscall64 vsyscall32
  • On the SuSE instances that I have access to lshw does not exist. Further, the /sys/class/dmi/... does not exist.
    – mdpc
    Sep 15, 2009 at 23:53

There is a handy app that might help called virt-what. I haven't used it with VMWare, but it did work nicely with Qemu.

  • 1
    Unfortunately the binary RPM has two dependancies dmidecode and util-linux-ng when tried on SuSE commercial.
    – mdpc
    Sep 16, 2009 at 17:49

Some virtual environments name some of their virtual devices with names that are a bit tell-tale, for example, VirtualBox presenting a graphics card that calls itself "VirtualBox Display Adapter". But looking for those ties you to a particular VM and possibly a narrow range of versions.

It might be possible for your code to see what sort of virtualisation it could set up. If that fails entirely, you might be in a VM. But you just as might easily be on a box that doesn't have any VM capable hardware.

  • Your first answer was the right one. Check device driver names.
    – Izzy
    Sep 15, 2009 at 23:47

For Linux you type dmesg |grep DMI:


[root@myhost ~]# dmesg |grep DMI
DMI 2.3 present.
DMI: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006  05/23/2012

[root@myhost ~]# dmesg |grep -i virtual
DMI: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006  05/23/2012
Booting paravirtualized kernel on bare hardware
input: Macintosh mouse button emulation as /devices/virtual/input/input1
scsi 0:0:0:0: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 4
input: Microsoft Vmbus HID-compliant Mouse as /devices/virtual/input/input4


[root@backdev1 ~]# dmesg |grep DMI
DMI 2.5 present.
DMI: IBM System x3650 M3 -[7945AC1]-/90Y4784, BIOS -[D6E153AUS-1.12]- 06/30/2011
  • 1
    a major problem with your solution is that dmesg reads out the kernel buffer and it is of limited size. If there are a lot of messages or a bit of time since the system has been rebooted, then this information will not be available.
    – mdpc
    Apr 10, 2014 at 20:05

There's lots of code out there to detect if you're in a VM or not. Start with red pill and search from there. This paper at Offensive Computing is also a good read.

That's if none of those easy ones above work :)

  • The first link is broken. The second is either broken or slow.
    – Wildcard
    Nov 3, 2016 at 22:28
  • You're right. The sands of time have eaten them... I'll see if I can come up with alternative links.
    – Bill Weiss
    Nov 12, 2016 at 4:34
  • It's a shame; "red pill" sounded interesting. :)
    – Wildcard
    Nov 12, 2016 at 4:41
  • 1
    Updated with archive.org links.
    – Bill Weiss
    Nov 12, 2016 at 19:50

You could also search the first part of your mac address here and see if it's listed as assigned to any of the virtualization companies.

  • Interesting idea....I think that works (as long as a network device is included in the VM ;-))
    – mdpc
    Sep 16, 2009 at 18:18
  • 2
    Won't be reliable. In many cases the mac can be set to an arbitrary value. This to enable cloning the mac of the original machine when converting it to VM. Some software ties its license to the mac and often it is impossible to get a new license (vendor went bust or costs is prohibitive).
    – Tonny
    Jan 22, 2013 at 20:24

Virtual devices will also be revealed by lspci and/or disk device info in /proc:

lspci | grep -i vmware

grep -i vmware /proc/scsi/scsi /proc/ide/*/model

In Linux, system information is revealed in /sys/devices/virtual/dmi/id/ . See my answer here for a handy script to show you all the information available.

root not required.


I didn't like any of these solutions, as there's usually a VMware CDROM driver or memory driver installed so dmesg confirms or denies it for me quickly.

[server@user ~]$ dmesg |grep VMware
hda: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
Vendor: VMware    Model: Virtual disk      Rev: 1.0
VMware memory control driver initialized
  • 3
    This will work at startup, but later you can't guarantee that dmesg hasn't been cleared or overflowed.
    – mattdm
    Feb 3, 2011 at 14:57
  • This is what I usually do too, that is grepping dmesg Aug 18, 2014 at 13:53

This worked better for me as it gives me specific information about the manufacturer and the product name.

dmidecode -t system|grep 'Manufacturer\|Product'

Output on Dell server:

Manufacturer: Dell Inc.
Product Name: PowerEdge C5220

Output on Virtualbox VM:

Manufacturer: innotek GmbH
Product Name: VirtualBox

Output on KVM/QEMU:

Manufacturer: QEMU
Product Name: Standard PC (i440FX + PIIX, 1996)

This is great for scripts that can parse these out for better identification of servers... but if you use Chef in your infrastructure, you can check the node attribute Virtualization -> system in the chef server .


Things have changed somewhat in the nearly 11 years since this was asked.

If you are using a distro with systemd installed (wrt OPs original question, SLES has used systemd since v12), systemd-detect-virt will probably work, does not need root, and produces the most script-friendly output with no further massaging required:

$ systemd-detect-virt

I like very much:

hostnamectl status 

or concrete:

hostnamectl status | grep "Chassis:"

How To Check If A Linux System Is Physical Or Virtual Machine

16 Methods To Check If A Linux System Is Physical or Virtual Machine

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .