How can I check if a Linux system is running on a physical or virtual machine?

If you work with Linux servers, chances are you are using SSH to connect to a remote server.

In cases like this, when you don’t have direct access to the system, you might wonder if your server is running in a virtual machine or on a physical system.

Let us show you how to do it.

Check if the server is physical or virtual

The easiest way to check this is to use the dmidecode command.

sudo dmidecode -s system-manufacturer

  • If it is a physical system, you should see the manufacturer’s name such as Dell, Lenovo, etc.
  • If it is a virtual system, you should see output like QEMU, innotek Gmbh (for VirtualBox).

The dmidecode command is used to decode the computer’s DMI information into a human readable format.

DMI, short for Desktop Management Interface, is a standard followed by (almost) all system manufacturers. DMI is used to manage and monitor components on a desktop, laptop, or server computer.

With DMI, you can get information about the system hardware, system manufacturer, and device serial number.

The dmidecode (DMI Decode) command retrieves this s system-manufacturer information and provides information about the system manufacturer.

If your system is real, you should see the manufacturer’s name:

[email protected]:~$ sudo dmidecode -s system-manufacturer
Dell Inc.

If it is a virtual machine, the information will be reflected accordingly.

[email protected]:~# dmidecode -s system-manufacturer

It was fast, wasn’t it? You can refer to the dmidecode command man page to see the keywords you can use to extract more information.

If you want to check the Linux version information, you will have to use the uname command because dmidecode is all about hardware details.

Hopefully this article helped you determine if your Linux server is running in a virtual machine or a physical machine.