[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is the command to access the temp sensors in a rpi4?



On Monday 18 January 2021 14:47:03 007@caiway.net wrote:

> On Sun, 17 Jan 2021 23:47:48 -0500
>
> Gene Heskett <gheskett@shentel.net> wrote:
> > Greetings all;
> >
> > Cheers, Gene Heskett
>
> cpu=$(</sys/class/thermal/thermal_zone0/temp) ; echo -e "CPU
> temperature: $((cpu/100)) Celsius"   | sed 's/\B[0-9]\{1\}\>/,&/'
>
> This oneliner works on pi3 and pi4
>
>
> I use this oneliner for some color:
> cpu=$(</sys/class/thermal/thermal_zone0/temp) ; echo -e "CPU
> temperature: \e[31m  $((cpu/100)) Celsius \e[0m"   | sed
> 's/\B[0-9]\{1\}\>/,&/'
>
> Or in a script:
>
> #!/bin/bash
> cpu=$(</sys/class/thermal/thermal_zone0/temp)
> echo -e "CPU temperatuur: \e[31m  $((cpu/100)) Celsius \e[0m" | sed 's/\B[0-9]\{1\}\>/,&/'
> #eof
>
> hope this helps

it does, thanks.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: