Recently I installed lm-sensor for monitoring my CPU temperature. I am monitoring it by this command in the terminal:

while [ true ]; do sensors; sleep 1; done

But I need to access my temperature after I run some stress test on the CPU to analysis some data. Is there a command that can write my temperature into a file during my stress test?


You can redirect the output of the sensors command to a file using the >> operator of the shell:

while [true]
   sensors >> */your/file/here*
   sleep 1

The >> operator redirects standard output of a command to a file so in this case it will write the output of sensors to the file you name. One second is pretty frequent, so you'll want to make sure you don't leave this process running.

| improve this answer | |

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.