5 lines
184 B
Bash
5 lines
184 B
Bash
#!/bin/sh
|
|
|
|
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 }'
|
|
|