0

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?

1

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

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

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.

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.