Skip to content

Instantly share code, notes, and snippets.

@alvarow
Last active May 26, 2016 18:21
Show Gist options
  • Save alvarow/f0484e3da9e38fafe8d4115c1a3d0f11 to your computer and use it in GitHub Desktop.
Save alvarow/f0484e3da9e38fafe8d4115c1a3d0f11 to your computer and use it in GitHub Desktop.
RaspberryPi temperature
#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU temperature of Raspberry Pi 2/3
# based of: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# -------------------------------------------------------
cpu=$((`cat /sys/class/thermal/thermal_zone0/temp|cut -c1-2`)).$((`cat /sys/class/thermal/thermal_zone0/temp|cut -c3-4`))
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => ${cpu}'C"
# /opt/vc/bin/vcgencmd measure_temp | sed "s/temp=\([0-9]\+\.[0-9]\+\)'C/\1/"
@alvarow
Copy link
Author

alvarow commented May 26, 2016

Here's sample output

root@pi3:~# ./pi-temp.sh
Thu May 26 14:13:20 EDT 2016 @ pi3
-------------------------------------------
GPU => temp=47.8'C
CPU => 47'C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment