Skip to content

HP Unix info

This is useful on HP Unix machines. It just prints out a few pieces of data of the machine.

  echo "HP Unix version      : " `uname -a`
  echo "Model                : " `/usr/bin/model`
  echo "Number of processors : " `/usr/sbin/ioscan -kf | grep processor | wc -l`

An example output would be be :

  HP Unix version      :  HP-UX machine B.11.23 U ia64 ident_nr unlimited-user license
  Model                :  ia64 hp server rx4640
  Number of processors :  4

Funnily there doesn’t seem to be a standard command to get the total amount of memory in the machine. HP says here that

  /etc/dmesg | grep -i phys

should work, but I don’t have the privileges to read this on the machines I use.

According to this site, the following C code can get this :

  #include <sys/param.h>
  #include <sys/pstat.h>
 
  struct pst_static pst; // data that can't change between boots
 
  pstat_getstatic ( &Pst, sizeof ( pst ), (size_t) 1, 0 );
  printf ( "System has %d KB of memory\n",
            pst.physical_memory * pst.page_size );

The machines I work with usually don’t have C installed (I know), so this hasn’t been tested.