cat > WHAT_EVER_YOU_WANT.sh
#!/usr/bin/ksh
#memory calculator
um=`svmon -G | head -2|tail -1| awk {'print $3'}`
um=`expr $um / 256`
tm=`lsattr -El sys0 -a realmem | awk {'print $2'}`
tm=`expr $tm / 1000`
fm=`expr $tm - $um`
echo "\n\n-----------------------";
echo "System : (`hostname`)";
echo "-----------------------\n";
echo "\n-----------------------";
echo " Users Login information \n";
for ENTRY in `finger | cut -d " " -f1 | grep -v Login | uniq`
do
echo "`finger -l $ENTRY | head -1 | cut -d \" \" -f14` ---> `finger -l $ENTRY |
awk '{ print $2 }' | tail -2 | head -1`";
#finger -l $ENTRY | awk '{ print $2 }' | tail -2 | head -1;
done
echo "\n----------------------";
echo "Memory Information\n\n";
echo "total memory = $tm MB"
echo "free memory = $fm MB"
echo "used memory = $um MB"
echo "\n\n-----------------------\n";
bash-4.2# chmod +x ./WHAT_EVER_YOU_WANT.sh
bash-4.2# ./WHAT_EVER_YOU_WANT.sh
#=================
nmon
h -- help
m -- memory
列出記憶體占用率前10的程序相關資訊:
svmon -Pt10 | perl -e 'while(<>){print if($.==2||$&&&!$s++);$.=0 if(/^-+$/)}'
用svmon -P pid檢視某個程序記憶體堆棧:
svmon -P pid
檢視記憶體使用情況:
svmon
==================
硬碟使用情況
df -g