#!/bin/sh # # free v0.2.1 # Something like linux "free" for FreeBSD. Info about physical memory # # (C)opyright 2005-2007 Kahvipannu.Com Administration # info@kahvipannu.fi # case "$1" in -m) echo -n 'Total memory: ' echo `sysctl -n hw.physmem`"/(1024^2)" | bc echo -n 'Used memory: ' echo `vmstat -s | grep "pages active" | awk '{print $1}'`"*"`sysctl -n hw.pagesize`"/(1024^2)" | bc echo -n 'Available memory: ' echo "("`sysctl -n hw.physmem`"/(1024^2))-("`vmstat -s | grep "pages active" | awk '{print $1}'`"*"`sysctl -n hw.pagesize`"/(1024^2))" | bc ;; *) echo -n 'Total memory: ' sysctl -n hw.physmem echo -n 'Used pages: ' vmstat -s | grep 'pages active' | awk '{print $1}' echo 'free -m for human readable mode' exit 64 ;; esac