Tuesday, 3 January 2017

How do you check linux Machine is Phyiscal or Virtual Machine

There is no hard and fast rule to check whether the machine is physical or virtual but still we do have some commands which can be used for the some purpose.

NOTE: There might be other commands as well but these are the few of my knowledge.

The command used to view all the required hardware related information for any Linux machine is



Method 1) On Linux you can use the command virt-what

[root@myhost]# virt-what
vmware

To Run Above command you need Root user privileges or Sudo privileges. 



Method 2) execute below statement on linux 


 grep -q ^flags.*\ hypervisor /proc/cpuinfo && echo "This machine is a VM"
This machine is a VM  ==> if machine is Virtual you will get this if physical output will be empty. 


I would appreciate if you can enlighten me with any more commands which you know in the comment section.



No comments:

Post a Comment