Home Linux Commands How to Check Virtualization Type in Linux System

How to Check Virtualization Type in Linux System

Linux can be run on various platforms including bare-metal, virtual servers, and even containers. If you are running a Linux server on a virtualized environment such as VirtualBox, you might probably want to know which type of virtualization technology it is running on.

In this guide, we explore various ways how to find the virtualization type on a Linux system.

1. Check Virtualization Type Using hostnamectl Command

The hostnamectl command is a command mostly used to display or set the system’s static hostname. On top of that, it displays other details about your Linux machine such as:

  • Machine and Boot ID
  • Virtualization type
  • Operating system
  • Architecture
  • Hardware Vendor and Model

As such, you can easily find out the virtualization technology on which your Linux server is hosted by simply running the command without any command-line options.

From the output below, you can see that the system is running on KVM virtualization.

$ hostnamectl
Check Virtualization Type in Linux
Check Virtualization Type in Linux

You can further narrow down the search results using the grep utility as follows.

$ hostnamectl | grep -i virtualization

Virtualization: kvm

2. Find Virtualization Type Using systemd-detect-virt Command

Modern Linux systems ship with systemd as the init system. The systemd package provides the systemd-detect-virt utility which can be invoked on the command line to detect the virtualization technology being used.

When executed on the command line, it reports the virtualization technology your system is running on.

$ systemd-detect-virt

kvm

If the system is hosted on VMWare, you will get the following output.

$ systemd-detect-virt

vmware

If your Linux machine is running on Oracle VirtualBox, you will get oracle as the virtualization type printed on the terminal.

$ systemd-detect-virt

oracle

To list all the detectable virtualization environments, run the command:

$ systemd-detect-virt --list
List Virtualization Environments in Linux
List Virtualization Environments in Linux

3. List Virtualization Type Using virt-what Command

The virt-what utility is basically a shell script that is used to determine if a program is running on a virtualization platform.

The shell script prints out the virtualization technology that your system is running on. If nothing is printed, it means that your machine is running on a physical or bare metal system or running on a virtualization technology that is yet to be recognized or identified.

The virt-what utility is not provided by default, and therefore, follows the steps below to install it.

$ sudo apt install virt-what        [On Debian, Ubuntu and Mint]
$ sudo yum install virt-what        [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
$ sudo emerge -a virt-what          [On Gentoo Linux]
$ sudo apk add virt-what            [On Alpine Linux]
$ sudo pacman -S virt-what          [On Arch Linux]
$ sudo zypper install virt-what     [On OpenSUSE]    

To view the virtualization type that your system is using, simply run:

$ sudo virt-what
List Virtualization Type in Linux
List Virtualization Type in Linux

4. Check Virtualization Type Using dmidecode Command

The dmidecode utility is a command line tool that parses the SMBIOS data, which reads both firmware and hardware data and prints it on the command line.

Apart from that, it can also display the virtualization type as follows.

$ sudo dmidecode -s system-product-name
Show Virtualization Type in Linux
Show Virtualization Type in Linux

This wraps our guide. In this tutorial, we have examined various ways of finding out the virtualization platform on which your system is running. As always, your feedback is welcome.

Winnie Ondara
My name is Winnie, a Linux enthusiast and passionate tech writer in Linux and DevOPs topics. I enjoy keeping abreast with the latest technologies in the Linux ecosystem and trying out new tools provided by the FOSS community.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.