Home Tutorials How to find the Raspberry Pi GPU and ARM CPU temperature from the terminal

How to find the Raspberry Pi GPU and ARM CPU temperature from the terminal

by shedboy71

You can actually check the temperature of the CPU and GPU with a couple of simple commands that you can type in the command line, this is very useful as depending what you are doing with the Raspberry Pi both the CPU and GPU can heat up – this is particular important with the new Raspberry Pi 4 which runs very hot compared to previous versions.

I have ran these on the first available Raspberry Pi that I could find which was a 3B. The CPU on this Raspberry Pi is a Broadcom BCM2837B0 and the GPU is a Broadcom VideoCore IV (BCM2837)

Show Raspberry Pi GPU temperature

Open the Terminal application and type the following command to view the GPU temperature:

vcgencmd measure_temp

OR

/opt/vc/bin/vcgencmd measure_temp

I saw the following values

gpu temperature

gpu temperature

Show Raspberry Pi ARM CPU temperature

Type the following cat command:

cat /sys/class/thermal/thermal_zone0/temp

The value you get will need to be divided by 1000 to get the ARM CPU temperature in more readable format. You can easily do this by typing in the following

cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo “$((cpu/1000)) c”

You should see something like this

cpu temperature

cpu temperature

Creating a simple bash script

Now you can create a bash script called pitemp.sh to see both ARM CPU and GPU temperature of Raspberry Pi. Type the following command:
nano pitemp.sh

Add the following code to the file:

#!/bin/bash
# Script: pitemp.sh
# Purpose: Displays the CPU and GPU temperature of Raspberry Pi 2/3
cpu=$(</sys/class/thermal/thermal_zone0/temp) echo “GPU => $(/opt/vc/bin/vcgencmd measure_temp)”
echo “CPU => $((cpu/1000))’C”

Save and close the file. Set the permission for the file like this

chmod +x pitemp.sh

You can run it as follows:

./pitemp.sh

You will see output like this:

GPU => temp=44.4’C
CPU => 44’C

You may also like