Skip to main content
Quick Tip

How to Check if Linux System is Running on Physical System or Virtual Machine?

Wondering if your Linux server is a virtual machine or a physical system? Here's how to check it.

Abhishek Prakash

Warp Terminal

If you work with Linux servers, chances are that you use SSH to connect to the remote server.

In such cases where you don't have direct access to the system, you might wonder whether your server is running in a virtual machine or on a physical system.

Let me show you how to do that.

Check if server is physical or virtual

There are several commands you can use for this purpose.

Using dmidecode command

The simplest way to check that is by using the dmidecode command.

sudo dmidecode -s system-manufacturer
  • If it is a physical system, you should see the name of the manufacturer like Dell, Lenovo etc.
  • If it is a virtual system, you should see an output like QEMU, innotek Gmbh (for VirtualBox).

The dmidecode command is used for decoding a computer's DMI information in human-readable format.

DMI, short for Desktop Management Interface, is a standard that (almost) all system manufacturer adhere to. The DMI framework is used for managing and tracking components in a desktop, laptop or server computer.

Thanks to DMI, you can get information about the system's hardware, system manufacturer and the serial number of the device.

The dmidecode (DMI Decode) command enables you to extract these information and with the -s system-manufacturer you can get the system manufacturer detail.

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

abhishek@handbook:~$ sudo dmidecode -s system-manufacturer
Dell Inc.

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

root@localhost:~# dmidecode -s system-manufacturer
QEMU

That was quick, wasn't it? You can refer to the man page of dmidecode command to see the keywords you can use to extract more information.

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

Using virt-what

Another way to check if server is running on virtual machine is by using virt-what.

It is basically a shell script that can be installed as a command in most Linux distributions.  

sudo apt install virt-what

If the server is running on a real, bare-metal system, it returns nothing. Otherwise, it will list some facts about the virtual machine.

root@localhost:~# virt-what 
kvm

I hope this quick helped you in determining whether your Linux server is running in a VM or on a physical machine.

Abhishek Prakash