Temperature Monitoring on Linux
2018 October 21

Here's a little shell function to view your system thermometers. Most people would just tell you to install the lm-sensors package, but that's another package. Why do that when Linux presents it through the sys filesystem.

function temp_sensors() {
    cat /sys/class/thermal/thermal_zone*/temp

These files present the temperature in millidegrees Celsius. So you should divide by a thousand if you want them in complete degrees. Below I have another function to display in Fahrenheit.

function temp_f_sensors() {
    temp_sensors | awk '{print (($1 / 1000 * (9/5)) + 32)}'

For more details about temperature monitoring on Linux I recommend that you take a look at this kernel documentation.

Written by Henry J Schmale on 2018 October 21