Virtualization is essential for running virtual machines (VMs) using tools like KVM, VirtualBox, or VMware. Before you set up a virtual environment, it's a good idea to confirm whether your CPU supports virtualization technology, such as Intel VT-x or AMD-V. This tutorial provides 2 methods how to check if CPU supports virtualization on Linux.
Method 1 - /proc/cpuinfo file
The /proc/cpuinfo
file contains detailed information about the processor, including supported features and flags. You can use the following grep
command to search for virtualization flags:
grep -m1 -oE 'vmx|svm' /proc/cpuinfo
vmx
- indicates Intel VT-x support.svm
- indicates AMD-V support.-m1
- stops at the first match.-oE
- extracts only the matching text (vmx
orsvm
).
If the CPU supports virtualization, it will output either vmx
or svm
. No output means virtualization is not supported.
Method 2 - lscpu command
The lscpu
command provides a structured summary of CPU architecture and features. You can use awk
to extract the virtualization support line directly:
lscpu | awk -F': *' '/Virtualization/{print $2}'
-F': *'
- it sets the field separator to a colon followed by optional spaces, allowing each line to be split into meaningful fields for easier extraction./Virtualization/
- matches the line showing virtualization type.print $2
- outputs the virtualization type (e.g., VT-x or AMD-V).
If the CPU supports virtualization, this command will output VT-x
(Intel CPU) or AMD-V
(AMD CPU).
Leave a Comment
Cancel reply