Reading the Raspberry Pi Temperature

In this guide, we will be showing you how to read the temperature of the Raspberry Pi using a simple command.

Raspberry Pi Temperature

Monitoring the temperature of your Raspberry Pi can be a critical task. This is especially true when you are using the device in areas with little airflow.

Officially the Raspberry Pi’s processor is built to withstand temperatures from -40°C to 85°C.

As the Raspberry Pi’s temperature gets closer to its upper limit, the system will automatically begin to throttle the processor to try and help the board cool back down.

This throttling makes it crucial to manage your Raspberry Pi’s temperature to stop the device from losing performance. The throttling can be extra problematic when you are trying to overclock your device.

Reading the temperature of your Raspberry Pi’s processing core is a simple task and can be done using a single command.

Getting the Raspberry Pi Temperature Using the Terminal

Luckily for us, the Raspberry Pi’s processor features an inbuilt temperature probe that we can access.

To be able to retrieve the temperature of the Raspberry Pi, you will need terminal access.

Once you have access to the terminal through SSH or physical access, then you can proceed.

1. To retrieve the temperature of your Raspberry Pi, we can utilize the following command.

/opt/vc/bin/vcgencmd measure_temp

2. From this command, you should get a result like we have below with specifying the temperature of your Raspberry Pi.


One thing that you will notice is that all results from this command are provided in degrees centigrade.

3. If you are in a country that uses Fahrenheit, then you can convert this number by using the following formula (celsius * 1.8) + 32

Alternatively, you can utilize the following command, which will automatically retrieve the value and convert the Raspberry Pi’s temperature to Fahrenheit for you.

/opt/vc/bin/vcgencmd measure_temp | awk -F "[=\']" '{print($2 * 1.8)+32}'

Creating an Alias to Retrieve the Pi’s Temperature

If you check the Raspberry Pi’s temperature often and would like to simplify the command, you can make use of bash aliases.

1. Let’s go ahead and start creating the bash aliases file within the pi user’s home directory by running the command below.

nano /home/pi/.bash_aliases

2. Within this file, enter the following line.

alias temp='/opt/vc/bin/vcgencmd measure_temp'

What this line does is make it so that whenever we type in the word temp, the temperature of the Raspberry Pi will be outputted to the command line.

Once you have entered this line, please save the file by pressing CTRL + X then Y followed by ENTER

3.Before you can use this new alias you need to quit out of the current session and open a new one.

Once you have exited out of the terminal session and gone back in, you will now be able to use the temp command to get your Raspberry Pi’s temperature.


Reducing your Temperature

If you are having trouble with maintaining your Raspberry Pi at reasonable temperatures, here is a quick couple of tips on how to help.

Add a heatsink

Adding a heatsink is one of the easiest ways of reducing the temperature of your Raspberry Pi’s processor.

Heatsinks work by increasing the amount of surface area from which heat can dissipate.

Increasing Airflow

One of the other best ways of improving your Pi’s temperatures is to increase the airflow around the board.

Airflow is one of the best and cheapest ways of efficiently removing heat from your Raspberry Pi.

The easiest way of increasing airflow is to make sure you don’t put the Pi in too much of a closed space as well as using a case that has proper ventilation

Using a fan

Adding a fan to your case is another way of reducing the temperatures of your Raspberry Pi.

The advantage of a fan, of course, is that it helps quickly remove heat from around the device and drag in cooler air.

The most significant disadvantage of using a fan, of course, is the extra noise it will produce.

At this point, you should now have an idea on how to retrieve the temperature of your Raspberry Pi’s processor using a simple command.

If you have any questions or feedback, then feel free to drop a comment below.


  1. Avatar for Edda Dammog
    Edda Dammog on

    For purposes of monitoring the temperature throughout the day,
    Is there a way to output the temperature to a file with date/time at regular intervals, say every hour?

    1. Avatar for Ton Wiegman
      Ton Wiegman on

      You can create a small script to get the date, the temp etc, and output that to a file.
      The file you could read and graph with e.g. gnuplot.
      With cron you can run the script at regular intervals:

      p=$(uname -n)
      t1=$(/opt/vc/bin/vcgencmd measure_temp)
      d=$(date +%Y%m%d%H%M%S)
      t2=$(echo $t1 | tr -d temp=\'C )
      echo $p,$d,$t2


      */5 * * * * /home/pi/script/ >> /home/pi/data/templog.txt

      Result (hostname of my pi is raspberry1):

  2. Avatar for pranka
    pranka on

    i am getting this error ‘bash: /opt/vc/bin/vcgencmd: No such file or directory
    when i execute the command. please help i am novice.

    1. Avatar for Emmet
      Emmet on

      Hi Pranka,

      What Raspberry Pi are you using? Also what operating system are you running on your Pi.

      I quickly tested this again on a Raspberry Pi 4 running the latest version of Raspberry Pi OS and it works as intended.


    2. Avatar for Ton Wiegman
      Ton Wiegman on

      Perhaps you did: bash /opt/vc/bin/vcgencmd?
      No need for the bash. vcgencmd is the program in /opt/vc/bin

  3. Avatar for SX
    SX on

    Nice tutorial, thanks!

  4. Avatar for Matthew Sykes
    Matthew Sykes on

    i only really want to find the current temp to test its working! I added a fan, then noticed in rpi-config gui you can set the fan to a gpio pin. maybe add that little detail to the tutorial?

    liking the alias file 🙂 made a few of my own too

  5. Avatar for Michael C.
    Michael C. on

    I got the temp out with no error after creating the batch file!

    Also thanks for the tutorial on installing Open Media Vault!
    I did it with confidence and fast. I felt like a pro as I’m remembering many commands to do different things!

    Anyways thanks again crew!
    Keep the goodwork going please and I want you guys to know I been coming here everyday since last week trying everything tgat I can so with my Rasp PI

    Thanks, Michael C.

  6. Avatar for MIchael Contes
    MIchael Contes on

    First I wanted to say thank you for you sharing your knowledge!
    I have bookedmarked your site from the day I found it on and I became imediately a loyal visitor when your tutorials helped me fast and easy when ever I have a problem or want to try out your other tutorials to keep learning more about my raspberry pi questions, problems and solutions.

    Thank You!

    But I have a question about this tutorial, I receive a error on the terminal app after executing this command on the terminal.
    “/opt/vc/bin/vcgencmd measure_temp | awk -F “[=\’]” ‘{print($2 * 1.8)+32}'”

    Output error that I recieve is…
    awk: warning: escape sequence `\” treated as plain `”

    I can see the temperature but I just wanted to ask you if its a error what do you suggest!


    1. Avatar for LaDell Bistline Jr
      LaDell Bistline Jr on


      This may help:

      /opt/vc/bin/vcgencmd measure_temp | awk -F[=\’] ‘{print”temp=”$2″ C “($2 * 1.8)+32″ F”}’

      The ‘ for the separators (after -F) has to be escaped, but it shouldn’t have to be in quotes.

      If you edit .bashrc (nano ~/.bashrc) you could add these lines:
      (This only works logged into root)

      alias temp=”_tempf”

      _tempf() {
      /opt/vc/bin/vcgencmd measure_temp | awk -F[=\’] ‘{print”temp=”$2″ C “($2 * 1.8)+32″ F”}’

      Ctrl-X and Y to save, then run bashrc (. ~/.bashrc) to update.

      the temp command should give:
      temp=41.8 C 107.24 F

      Hope this helps

Leave a Reply

Your email address will not be published. Required fields are marked *