How to find out Raspberry Pi GPU and ARM CPU temperature on Linux

I am using a Raspberry PI 2/3 credit size computer. How do I find out my Raspberry PI GPU or CPU temperature from Linux operating system command line option? How do I monitor the core temperature of my Raspberry Pi 3?

The Raspberry Pi is a small and affordable computer for student and hobbyist. You can us it to learn programming, Linux, sysadmin and devops stuff. One can easily find out the Raspberry Pi GPU and ARM CPU core temperature using the following commands.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Raspberry PI with Linux
Est. reading time 1 minutes

Show Raspberry Pi GPU temperature

Open the Terminal application and type the following command to view GPU (Graphics Processing Unit) temperature:
vcgencmd measure_temp
OR
/opt/vc/bin/vcgencmd measure_temp
Sample output:

Fig.01: Find Raspberry pi GPU temperature

Fig.01: Find Raspberry pi GPU temperature

Display Raspberry Pi ARM CPU temperature

Type the following cat command:
cat /sys/class/thermal/thermal_zone0/temp
Divide it by 1000 to get the ARM CPU temperature in more human readable format:

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

Sample outputs:

Fig.02: Check on the ARM CPU temperature of Raspberry Pi

Fig.02: Check on the ARM CPU temperature of Raspberry Pi

Raspberry Pi get temperature – Putting it all together

Create a simple bash script called my-pi-temp.sh to see both ARM CPU and GPU temperature of Raspberry Pi. Type the following command:
nano my-pi-temp.sh
OR
vi my-pi-temp.sh
Append the following code:

#!/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+
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"

Save and close the file. Set permission:
chmod +x my-pi-temp.sh
Run it as follows:
./my-pi-temp.sh
Sample outputs:

Thu 10 Mar 01:02:19 IST 2016 @ raspberrypi
-------------------------------------------
GPU => temp=44.4'C
CPU => 44'C

Conclusion

This page explained how to monitor the core temperature of your Raspberry Pi. For more info see this VideoCore-Tools page.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 17 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
17 comments… add one
  • onebuck Mar 12, 2016 @ 14:52

    The temperature sensor for the SoC is on the same silicon. Your reading the same sensor for CPU when you say access to GPU. Propagation(delay) is what you are seeing when accessing the temperature for the CPU when you are assigning for the GPU temperature. Same sensor, CPU temperature access is correct but your GPU does not have a sensor independently. Just a CPU temperature can be truly accessed. Leave out the GPU temp and you will be correct. Same metric for temperatures.

    • meow Apr 28, 2016 @ 11:05

      You are right, no need for measuring CPU and GPU separately for SoC.

  • Riven Mar 29, 2016 @ 19:16

    best way to see thermal temps and arm_freq via terminal command:
    while true; do vcgencmd measure_clock arm; vcgencmd measure_temp; sleep 1; done

    To check it under 100% CPU load:
    sudo apt-get install sysbench
    while true; do vcgencmd measure_clock arm; vcgencmd measure_temp; sleep 1; done& sysbench –num-threads=8 –test=cpu –cpu-max-prime=10000000000 run

    For optimizing, benching, and overclocking, see:
    https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=138840

  • Riven Mar 29, 2016 @ 19:22

    to see all cores and load % (hit ‘1’), enter in terminal:
    top

  • dmaraid Apr 10, 2016 @ 7:08

    In one line:

    echo -e "CPU => $(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc)'C\nGPU => $(/opt/vc/bin/vcgencmd measure_temp | sed "s/^.....//g")"

  • hannes Jun 3, 2016 @ 7:37

    Thank you, great post!

    Just a simple addition to your ‘my-pi-temp.sh’ script:

    echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp | cut -d = -f2)"

    Makes the output a little cleaner ;-)

  • Larry Dighera Jul 25, 2016 @ 22:10

    Below is the script I use for displaying RPi temperature and frequencies. It’s a hack, but usable.

    380166327609dbaab56c8f_000002

  • Richard Aug 28, 2016 @ 18:21

    Larry, very useful script! I hope you don’t mind a few changes that I made.

    380166327609dbaab56c8f_000003

  • Richard Aug 28, 2016 @ 18:24

    Somehow, I lost some spacing in the script even though my copy has them. Aargh!

    • 🐧 Vivek Gite Aug 28, 2016 @ 20:47

      You need to wrap script between <pre> and </pre> . I edited out to add <pre> and </pre> in your comment. Cheers.

      • Richard Nov 10, 2016 @ 16:09

        Vivek – thanks (belated!).

  • enola Sep 29, 2016 @ 19:18

    Thanks mate, this is really helpful !
    enola

  • Kamran Feb 7, 2017 @ 17:51

    worked nicely.
    My question is: is there such a nice code to do it in python, too?

  • Devilholk Feb 28, 2017 @ 11:51


    def get_temp():
    with open('/sys/class/thermal/thermal_zone0/temp', 'r') as infile:
    return float(infile.read()) * 1e-3

  • canuck Nov 21, 2020 @ 0:41

    To WATCH cpu temp:
    watch -n 1 vcgencmd measure_temp
    To WATCH clock speed in hertz:
    watch -n 1 vcgencmd measure_clock arm

  • CogRaok Dec 29, 2020 @ 22:52

    Three and a half year later…

  • alex Mar 22, 2021 @ 18:42

    Thank you for the scrip. Nicely done

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum