Sometimes on your GNU/Linux machine you need to know if you’re running Linux on a virtual machine or not using the command line.
The virtual machine is hosted from a real machine, but the running virtualized machine is different, at least looking at the disk size, and other times respect to how much RAM’s been used. Any virtualized environment you can use: Xen Server, VM Ware, Hyper-V, it’s installed on a very powerful physical machine. With lots of RAM, maybe with an external Storage Server. Each virtual machine you can create is going to use just a part of all that RAM.
Under GNU/Linux you can know if the running machine is real or a virtualized one.
Just use this BASH script:
#!/bin/bash checkVar=$(cat /proc/cpuinfo | grep -i hypervisor) if [ -z "$checkVar" ]; then if [ -d "/proc/vz/" ]; then checkVar=$(ls -al /proc/vz/) else checkVar=$(dmesg | grep -i virtual | grep -i -e vbox -e virtualbox -e "virtual box" -e vmware -e kvm -e bochs -e qemu -e xen -e "virtual hd" -e "virtual cd") fi fi if [ -z "$checkVar" ]; then echo "Real Machine" else echo "Virtualized Machine" fi