Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/rc/bin/mem

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc 
# show available and used memory in 
# user-discernible format. 
all=`{cat /dev/swap | sed 's,/, ,g'} 
# 4096/(1024*1024)
pageinmb=0.00390625 
mem = `{echo $all(1)^'*'^$pageinmb | hoc} 
memtotal= `{echo $all(2)^'*'^$pageinmb | hoc} 
swap = `{echo $all(4)^'*'^$pageinmb | hoc} 
swaptotal = `{echo $all(5)^'*'^$pageinmb | hoc} 
echo memory: $mem MB used, $memtotal MB total 
echo swap: $swap MB used, $swaptotal MB total

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.