Geeklet: 1-minute average CPU load

Geeklet for Average CPU Load

Last week I divulged one of my more complex GeekTool/NerdTool scripts. This week, one of the simplest: a processor load indicator.

This one doesn’t even need to call a script, it’s a one-liner you can run directly as the command for a shell Geeklet. Just drag a new shell item from GeekTool/NerdTool to your desktop and use this as the command:

uptime|awk '{print $(NF-2)}'|grep -v average

Update: The command above was a little longer than it needed to be. As noted by Michael in the comments, you can substitute uptime for w|head -1 and get the same result with less work.

That will feed the one-minute load average from the w command1 to your desktop, where you can set the font and color as desired. Easy peasy. In the next Geeklet post, I’ll share a script for finding out what the top CPU-consuming processes are and displaying a color-coded list on the desktop.

  1. I can’t remember why I added the grep command to the end of it, but the -v would remove any lines that had the word “average” in them. You can probably leave that off unless you run into strange output.

Brett Terpstra

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff on Twitter, GitHub, and Mastodon. Keep up with this blog by subscribing in your favorite news reader.

This content is supported by readers like you.

Join the conversation