Skip to content

Instantly share code, notes, and snippets.

@gmcclins
Last active October 25, 2017 16:50
Show Gist options
  • Save gmcclins/655fa5a7a7901935534f18b3c662d467 to your computer and use it in GitHub Desktop.
Save gmcclins/655fa5a7a7901935534f18b3c662d467 to your computer and use it in GitHub Desktop.
Get CPU & GPU Temps
#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU temperature of Raspberry Pi 2/3
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# Updated: Geoffrey McClinsey <hashbang.sh> under GPL v2.x+
# Changed: Made the output a little cleaner
# -------------------------------------------------------
gpu=$(/opt/vc/bin/vcgencmd measure_temp)
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU -> $gpu" | sed -e 's/temp//g' -e 's/=//g'
echo "CPU -> $((cpu/1000))'C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment