myhome/.local/bin/sb-cpu

7 lines
175 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
print_cpu() {
cpuUse=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
echo -e "💻 $cpuUse"
}
print_cpu