How much memory is in this UNIX system?

[last update: 2008-03-2 - added OpenVMS]

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 are a list of commands that I've used over and over again across the various UNIX and Linux platforms 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

[added 2007-11-12]

FreeBSD

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

[added 2007-12-07]

AIX

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

[added 2008-03-22]

OpenVMS

  • show mem /page