Skip to content

Instantly share code, notes, and snippets.

@kezenwa
Forked from egulhan/cpuUsageInPercent.sh
Created May 3, 2023 19:23
Show Gist options
  • Save kezenwa/3e79cc46cb8021a264351a45035ee691 to your computer and use it in GitHub Desktop.
Save kezenwa/3e79cc46cb8021a264351a45035ee691 to your computer and use it in GitHub Desktop.
How to get CPU usage in percent on Linux
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment