查看CPU使用率的脚本

#!/bin/sh
num=$(top -b -n 1 | sed -n '3p' | awk '{print $8}')
cpu_use=$(awk -v y=$num 'BEGIN{printf "%.1f\n",100-y}')

notify-send "CPU使用率:$cpu_use"

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注