1

Suppose I have logged in through sshto a given Linux machine, knowing nothing about it.

How can I quickly check what virtual environment (VMWare, VirtualBox, LXC, etc., if any) is currently running on this machine?

AER
  • 139
syntagma
  • 12,311
  • 1
    You might use dmesg to view hardware type of, for example, the harddrive. Try dmesg|egrep -i 'vmware|vbox' – Lambert May 04 '15 at 07:38
  • 1
    What do you want to know, that you did log into a VM client and which it is (which VM is ssh running in)? Or that you logged into a server and what VM has been started on it (which is the literal meaning of "what cultural environment is currently running on" this machine)? – Anthon May 04 '15 at 13:06
  • I want to know which VM is ssh working in. – syntagma May 04 '15 at 13:13

3 Answers3

2

If you're logging into a Virtual Machine, some of the hardware listed should be related to that Virtual Machine. Using a command like dmidecode | grep VMware should let you see if you're logged into a VM from VMware.

If you're not sure about what VM are you looking for, you could use just dmidecode | head -n 40 just to take a look at the system manufacturer, which should be a VM name if the system is running on one.

2

I like virt-what, which encapsulates a lot of this in an easy interface:

# virt-what    # VMware
vmware

# virt-what    # KVM/Qemu (libvirt)
kvm

# virt-what    # A real physical server

# virt-what    # VirtualBox
virtualbox
Chris Davies
  • 116,213
  • 16
  • 160
  • 287
0

There are multiple ways to test it.

1) dmesg |grep -i hypervisor detected ==> Hypervisor detected: VMware

2) dmidecode -s system-product-name ==> VMware Virtual Platform

These should work on most of the linux kernels