I just bought a heat sink kit for my pi and I'm using Raspbian and would like to monitor the temperature continuously every 3 seconds via SSH while I perform tasks on the pi so that I don't have to keep manually entering in a command to display the current temperature, how do I do that?


I think using watch command is much easier, for example:

watch {your command}

In your case, it will be:

watch vcgencmd measure_temp

That will refresh by 2 seconds, if you want to define the interval by yourself (5 second maybe), you can type:

watch -n 5 <your command>

In your case, it will be:

watch -n 5 vcgencmd measure_temp

You can cancel that with Ctrl+C.

  • much more elegant and simple, thanks for the response
    – bsara
    Jan 3 '17 at 16:47
  • the use of watch is new to me. very elegant.
    – tswaehn
    Sep 26 '20 at 10:46

The command for viewing the current temperature is found in this post: https://raspberrypi.stackexchange.com/a/1847/22221

To automate this such that you can view the temperature every 3 seconds without entering new commands can be accomplished by writing a simple shell script that has an infinite loop:


echo "Press [ctrl+c] to end monitoring"
echo ""

while true
  vcgencmd measure_temp
  sleep 3s

Place that text in a file called monitor-temp and place it in ~/bin/ (if !/bin/ doesn't already exist, then just create it with mkdir ~/bin). Make monitor-temp executable: chmod 755 ~/bin/monitor-temp. End your terminal (or ssh) session and start a new one. Now you can run monitor-temp from any location in the file system via ssh or directly on the machine and you'll see something like the following:

pi@raspberrypi ~ $ monitor-temp
Press [ctrl+c] to end monitoring


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.