#!/bin/bash
# 获取可用内存
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}'
# 获取CPU负载
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'
linux_shell输出可用内存和cpu占用情况
最新推荐文章于 2023-08-29 10:20:57 发布