How much memory is in this UNIX system?

This is a relatively simple question, "but alas, poor Yorick!", the answer isn't as plain sailing. All flavours of UNIX including nowadays Linux systems can and often are fundamentally different, as are the commands they use to get the simplest of information.

Some variants of UNIX require kernel probes, others simply provide a method of extracting the output from dmesg to provide the information, whilst others don't.

Some UNIX and Linux systems have utilities or scripts to interrogate it's hardware which generally reports a variety of things, including memory, and again some don't.

I could ramble on and on and on, but lets not. Below is a list of commands that I've used over and over again across various UNIX and Linux platforms that I encounter on a daily basis. Some are available on certain releases of each OE whilst others aren't.

Solaris

dmesg | grep mem
prtdiag | grep Memory
prtconf | grep Memory
psrinfo -v

HPUX

dmesg | grep Physical
machinfo | grep Memory
print_manifest | grep Memory

Linux

dmesg | grep Memory
grep -i memtotal /proc/meminfo
cat /proc/meminfo
free -m
vmstat -s

FreeBSD

dmesg | grep memory
grep memory /var/run/dmesg.boot
sysctl -a | grep mem

AIX

bootinfo -r
lsattr -E1 sys0 -a realmem
getconf REAL_MEMORY

OpenVMS

show mem /page