Skip to content

Instantly share code, notes, and snippets.

@Beaglefoot
Created August 4, 2022 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Beaglefoot/4d8c48cd5aecbcba0f61524ad63d83cd to your computer and use it in GitHub Desktop.
Save Beaglefoot/4d8c48cd5aecbcba0f61524ad63d83cd to your computer and use it in GitHub Desktop.
avg_cpu_load
#!/bin/bash
cat /proc/stat | awk ' $1 == "cpu" { idle_time = $5; for (i = 2; i <= 10; i++) total_time += $i } END { print 100 - 100 * (idle_time / total_time) } '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment