Open In App

How to Find Out the Virtualization Type in Linux System?

Last Updated : 21 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

If you understand the concept of virtual machines, you must have heard of the virtualization type. It is the technique to create and maintain virtual machines. Virtualization type evaluates how a virtualization software manages the host OS and the physical hardware to deliver a virtualization environment.

How to Find Out the Virtualization Type in Linux System?

 

A virtualization type depends on a virtual machine’s specific requirements, OS support, isolation level, and performance needs. Hence, it is good to know about the virtualization type of a system to get in-depth details. 

There are a few commands you can try to check the Virtualization Type in Linux. So in this tutorial, we will explain all the essential commands to check the virtualization type.

Virtualization Type in Linux System

We have divided this section into multiple parts to explain all the commands in a brief: 

The virt-what Command

The virt-what in Linux checks specific features to identify the system’s environment. Using this utility, you can find the virtualization type of your system. In most of the Linux distributions, the virt-what utility is not pre-installed. You can install virt-what utility by running the following command: 

sudo apt install virt-what [For Debian, and Ubuntu users]
sudo pacman -S virt-what [For Arch users]
sudo yum install virt-what [For RHEL users]
sudo apk add virt-what [For Alpine users]

 

Now, all you need to do is run the below command to display the current virtualization type of the system: 

sudo virt-what
The virt-what Command

virt-what command

As you can see in the image above, this command displays that your system is running in VirtualBox, and the virtualization type is ‘KVM.’

The systemd-detect-virt Command

The systemd-detect-virt command is a part of the ‘systemd suite,’ a service manager used in all Linux distributions. This command shows the following result when you run it in the terminal.

systemd-detect-virt
The systemd-detect-virt Command

systemd-detect-virt command

The virt-what and systemd-detect-virt commands show different results for the system. It is because the first-what command detects the virtualization technology and gives the ‘KVM’ output. The systemd-detect-virt command displays Oracle, indicating that your system is running in the Oracle VM VirtualBox environment rather than specifying the virtualization type. This means the virt-what command provides a more accurate result than the system-detect-virt command.

Moreover, you can also list all the detectable virtualization types using the following command:

systemd-detect-virt --list
The systemd-detect-virt Command.0

system-detect-virt –list command

Although systemd-detect-virt is an excellent command, there is an alternative named hostnamectl. Many users prefer to go for this alternative: 

The hostnamectl Command

Majorly hostnamectl Command displays the system’s static-related information, including the virtualization details: 

hostnamectl
The hostnamectl Command

hostnamectl command

You can also alter the result and only display the virtualization type using the below command:

hostnamectl | grep -i virtualization
The hostnamectl Command.0

hostnamectl | grep -i virtualization command

The above commands are already superior in providing information related to the virtualization type of a system. However, there are a few commands which only give you basic information, i.e., whether your system is running in the VirtualBox or a physical system: 

The dmidecode Command

The dmidecode command line tool parses the SMBIOS data, reads hardware and firmware data, and shows the output. 

sudo dmidecode -s system-product-name
The dmidecode Command

dmicode command 

The lshw Command

You can use the lshw command to list detailed information on the system’s hardware configuration. 

sudo lshw -class system
The lshw Command

lshw command 

Conclusion

In this tutorial, we have described How to Check the Virtualization type in Linux using several methods. The easiest and most accurate command for this is the virt-what command, which first shows whether the system is in a physical environment or VirtualBox. If your system runs in VirtualBox, it also mentions the virtualization type.

After that, the ‘system-detect-virt’ and ‘hostnamectl’ commands only indicate the type of VirtualBox. Furthermore, if you want to know whether the system runs in VirtualBox or a physical environment, please use the dmidecode or lshw command.

Also, Read



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads