dotfiles/.local/scripts/9995_cpu

6 lines
197 B
Plaintext
Raw Normal View History

2022-08-14 02:10:53 +08:00
#!/bin/bash
usage=$(cat <(grep 'cpu ' /proc/stat) <(sleep 0.3 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' | cut -d'.' -f1)"%"
echo " $usage"