User avatar
hardwaremack-orginal
Posts: 55
Joined: Fri Jun 28, 2019 7:52 pm

one line cpu temp monitor real time

Mon Jul 01, 2019 7:41 pm

Code: Select all

while true; do vcgencmd measure_temp; sleep 1s; done
I had to dive through pages of stuff to find this.
enjoy!

echmain
Posts: 226
Joined: Fri Mar 04, 2016 8:26 pm

Re: one line cpu temp monitor real time

Mon Jul 01, 2019 7:43 pm

How much are you increasing the temperature by constantly monitoring the temperature?

User avatar
rpdom
Posts: 14790
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: one line cpu temp monitor real time

Mon Jul 01, 2019 7:58 pm

echmain wrote:
Mon Jul 01, 2019 7:43 pm
How much are you increasing the temperature by constantly monitoring the temperature?
Probably negligible. That command takes very little processor power to run once a second.

Roken
Posts: 289
Joined: Sun Dec 31, 2017 4:35 pm
Location: UK

Re: one line cpu temp monitor real time

Mon Jul 01, 2019 8:00 pm

Code: Select all

watch -n 1 vcgencmd measure_temp
works, too.
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23083
Joined: Sat Jul 30, 2011 7:41 pm

Re: one line cpu temp monitor real time

Mon Jul 01, 2019 10:36 pm

Or you could add the CPU temperature icon to the task bar in the desktop....
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jahboater
Posts: 4595
Joined: Wed Feb 04, 2015 6:38 pm

Re: one line cpu temp monitor real time

Mon Jul 01, 2019 10:47 pm

Try this little script, it shows all sorts of info:

Code: Select all

#!/bin/bash
vcgencmd get_config int
Counter=14
DisplayHeader="Time       Temp     CPU     Core          Health          Vcore"
while true ; do
  let ++Counter
  if [ ${Counter} -eq 15 ]; then
	echo -e "${DisplayHeader}"
	Counter=0
  fi
  Health=$(perl -e "printf \"%19b\n\", $(vcgencmd get_throttled | cut -f2 -d=)")
  Temp=$(vcgencmd measure_temp | cut -f2 -d=)
  Clockspeed=$(vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
  Corespeed=$(vcgencmd measure_clock core | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
  CoreVolt=$(vcgencmd measure_volts | cut -f2 -d= | sed 's/000//')
  echo -e "$(date '+%H:%M:%S')  ${Temp}  $(printf '%4s' ${Clockspeed})MHz $(printf '%4s' ${Corespeed})MHz  $(printf '%020u' ${Health})  ${CoreVolt}"
  sleep 5
done
For example:

Code: Select all

Time       Temp     CPU     Core          Health          Vcore
23:41:48  52.0'C  1600MHz  600MHz  00000000000000000000  0.8490V
23:41:53  51.0'C  1600MHz  600MHz  00000000000000000000  0.8490V
23:41:58  52.0'C  1600MHz  600MHz  00000000000000000000  0.8490V
23:42:03  53.0'C  1600MHz  600MHz  00000000000000000000  0.8490V
23:42:09  52.0'C  1600MHz  600MHz  00000000000000000000  0.8490V
23:42:14  50.0'C   400MHz  200MHz  00000000000000000000  0.8490V
23:42:19  50.0'C   400MHz  200MHz  00000000000000000000  0.8490V
23:42:24  49.0'C   400MHz  200MHz  00000000000000000000  0.8490V
23:42:29  49.0'C   400MHz  200MHz  00000000000000000000  0.8490V
23:42:34  48.0'C   400MHz  200MHz  00000000000000000000  0.8490V

Return to “General discussion”