Skip to content

Instantly share code, notes, and snippets.

@vallieres
Last active August 29, 2015 14:01
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 vallieres/0945f33facde1b8114ed to your computer and use it in GitHub Desktop.
Save vallieres/0945f33facde1b8114ed to your computer and use it in GitHub Desktop.
Get Chip Temperature for Raspberry Pi
#!/bin/bash
######################################################################
# Raspberry Pi
#
# Gross Script by Vallières (Alexandre Vallières-Lagacé) <alexandre.valliereslagace@gmail.com>
# V1.0 2014-05-16
#
# Use the thermal zone0 to obtain the Temp of the SOC
#
# No dependencies
#
######################################################################
temp_cel=`awk '{printf("%.1f\n",$1/1e3)}' /sys/class/thermal/thermal_zone0/temp`
temp_far=`awk '{printf("%.1f\n",$1*1.8/1e3)}' /sys/class/thermal/thermal_zone0/temp`
echo Temperature = $temp_cel\°C \($temp_far°F\)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment