Linux measure cpu temperature command. How do I do it?

I am wondering if it is possible to to measure cpu temperature on Linux and keep track of it. Like history of CPU temperature. Is it possible? I tried your page

Which give me command:

sudo sensors*

But it only shows current cpu temperature on Linux. I want to see history of past few days. Is it possible to measure cpu temperature

Is this Linux desktop or server?

Linux desktop but looking forward to see server specific information too.

For the desktop, I use GKrellM to monitor cpu usage and temps (and some other things).

Thank you. Question, does that keep log of previous 7 days or 30 days? I want to see history.

I don’t believe so. That’s not a need I have (at this time), but you’ve given me a(nother) new project to work on.

if you are in a hurry and you need it, you can create a script which executes the following command every a scheduled time (5 seconds? 2 seconds?)

 sensors | awk '{if ($1=="Core") {print $3} }'  | awk -F° -v currDate="$(date +"%y-%m-%d_%T")"  'BEGIN {printf"%s ; ",currDate } {printf"%s ; ",$1} END {printf"\n"}'

I know, I know, it is horrible, but it works

1 Like

@tomboi check out Twitter thread, you may find useful suggestions

1 Like

Hey! A few days late here, but I made a really basic version of what you are asking for on my home media server. Currently it is a series (could be condensed or redone) of shell scripts that are set to run as cronjobs. Currently it used grep to grab to sensors output for specific information, and does this with disk information; then appends it to given files; then once a day compile the days logs (runs every 30min) to one large log file with that days date (used date command). Then finally move the finished log file to a given archive directory. To expand on this with some future intentions/ideas…I have been wanting to take the archiving a step further and add by week, then month, then by year archiving per directory. Additionally adding more points of data for log collections could be cool/useful. Hope this helps. Read this on twitter and wanted to share some work I’ve done. Wishing you the best! -Boomer

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki