标签:硬盘 cat shel print free 内存 smb code int
[root@tiger ~]# cat 1.sh
#!/bin/sh
free -m | awk ‘NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $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)}‘
[root@tiger ~]# chmod a+x 1.sh
[root@tiger ~]# bash 1.sh
Memory Usage: 456/7805MB (5.84%)
Disk Usage: 3/17GB (19%)
CPU Load: 0.99
标签:硬盘 cat shel print free 内存 smb code int
原文地址:https://blog.51cto.com/14051712/2416493