#!/bin/bash # Script: pi-temp.sh # This should work on both arch and ubuntu/debian # Purpose: Display the ARM CPU and GPU temperatures of Raspberry Pi 2/3/4/Zero # Edited by: srepac # convert C to F and show both temps in output # ------------------------------------------------------- # install basic calculator for conversions if [ `which bc | wc -l` -le 0 ]; then sudo apt-get install bc -y fi MODEL=$(tr -d '\0' ${cpuC}'C\t${cpuF}'F\n" printf "GPU => ${GPUTEMP}'C\t${gpuF}'F\n" MHZ=`sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq` #echo "CPU0 MHZ: $((MHZ/1000))" #echo "CPU (All) MHz: " count=0 for i in `sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq`; do cpu=`echo "scale=2; $i / 1000" | bc` echo "CPU${count} MHz: $cpu" count=`expr $count + 1` done sudo vcgencmd measure_volts | sed 's/volt=/vCore /g' sudo vcgencmd get_throttled