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?

3
  • 1
    You might use dmesg to view hardware type of, for example, the harddrive. Try dmesg|egrep -i 'vmware|vbox'
    – Lambert
    May 4, 2015 at 7: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 4, 2015 at 13:06
  • I want to know which VM is ssh working in.
    – syntagma
    May 4, 2015 at 13:13

3 Answers 3

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
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

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