get Raspberry Pi temperature

The temperature can be read directly from a sensor on the RPi, in this file:

# cat /sys/class/thermal/thermal_zone0/temp

As you can see it comes in milli-degrees Celsius. Use awk to convert it to degrees:

# awk '{print $1/1000 " C"}' /sys/class/thermal/thermal_zone0/temp
50.843 C

Leave a Reply

Your email address will not be published. Required fields are marked *