dwmblocks/scripts/sb-cpu

5 lines
184 B
Plaintext
Raw Normal View History

2021-09-27 22:16:38 +01:00
#!/bin/sh
2022-01-08 17:04:07 +00:00
top -b -n2 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' -v prefix="CPU " '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f%%\n", prefix, 100 - v }'
2021-09-27 22:16:38 +01:00