Linux: cat /proc/meminfo. On Solaris, one can dump the hardware device tree - this will include the memory.
(I can't remember the command). IIRC, on HP-UX, one of the
*scan commands will show the physical amount of memory.
Typically, after a reboot, dmesg will show that info there
somewhere as well. Of course, none of this is very platform
independent.