jingzhu_rk3588/moniter.sh

7 lines
257 B
Bash
Executable File

#!/bin/bash
while true; do
clear
echo "CPU 使用率: $(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}')%"
echo "内存使用率: $(free -m | awk 'NR==2{printf "%.2f%%\n", $3 * 100/$2 }')"
sleep 1
done