Average CPU temperature
This is a one-liner to get the average CPU temperature using lm-sensors and Perl. Useful for status bars such as Dzen, commonly used in lightweight window managers.
sensors | perl -ne 'if (/^Core \d+:\s+\+(.*?)°C/) { $s += $1; $c++; } END { printf("%.1fC", $s/$c) }'
It averages the temperature readout for all available CPU cores.
Written by Ivan Mirić
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors
janosgyerik
25.11K
Jean-Remy Duboc
12.22K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#