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
But the output would be very long and hard to find out the specific details looking for. So, lets narrow it down
# dmidecode -s system-product-name System x3550 M2 -[7284AC1]-
As you can see in one of my servers I see the above information which says the machine I am using is IBM System X
Now to get more details about the system
# dmidecode | less (And search for "System Information") System Information Manufacturer: IBM Product Name: System x3550 M2 -[7284AC1]- Version: 00 Wake-up Type: Other SKU Number: XxXxXxX Family: System x
Some more examples for different product
# dmidecode -s system-product-name ProLiant BL460c G6
# dmidecode | less System Information Manufacturer: HP Product Name: ProLiant BL460c G6 Version: Not Specified Wake-up Type: Power Switch Family: ProLiant
For a IBM blade chasis
# dmidecode -s system-product-name BladeCenter HS22 -[5940PRX]-
# dmidecode | less System Information Manufacturer: IBM Product Name: BladeCenter HS22 -[5940PRX]- Version: 06 Wake-up Type: Other SKU Number: XxXxXxX Family: System x
# dmidecode -s system-product-name VMware Virtual Platform
# dmidecode | less System Information Manufacturer: VMware, Inc. Product Name: VMware Virtual Platform Version: None Wake-up Type: Power Switch SKU Number: Not Specified Family: Not Specified
# lspci | grep -i vmware 00:0f.0 VGA compatible controller: VMware SVGA II Adapter
I would appreciate if you can enlighten me with any more commands which you know in the comment section.