#!/bin/sh
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
¼³¸í ; 2¹ø°ÁÙ $3/$2 $3*100/$2 À» Ãâ·Â ÇØÁØ´Ù
df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'
$ ./foo.sh
Memory Usage: 4986/7994MB (62.37%)
Disk Usage: 23/68GB (35%)
CPU Load: 0.78
¿¹Á¦
6¹öÀü¿¡¼ ¸Þ¸ð¸® ±¸ÇÒ¶§ ÀÌ·¸°Ô »ç¿ë ÇßÀ½
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $2-($4+$5+$6+$7),$2,($2-($4+$5+$6+$7))*100/$2 }'
Á¦