The definition of 'virtual' is too loose. If we assume that for AIX you mean any AIX image which is an LPAR (or a micro-partition, or any other terminology IBM chooses) then you can use uname -L
, for example,
nonlpar# umame -L
-1 NULL
lparhost# uname -L
5 lparhost
If you mean WPAR, you can use uname -W
and a result of 0 means you're not in a WPAR, a result of anything higher than 0 is a WPAR.
If you mean, does the AIX instance rely on a VIO server, then there's no solid reliable mechanism for knowing that other than looking at the devices and working out if they're presented via VIO servers.
It's worth remembering that for pSeries hardware running AIX, just about everything these days is an LPAR, and so essentially virtual, even if it's the only OS instance using the hardware.