Temperature monitoring help

8,038

Solution 1

There are text files containing temperature data here: /sys/devices/platform/coretemp.0/hwmon/hwmon[0-9]

The [0-9] is shown as a variable. There is actually just a single digit number there, that changes from from startup to startup.

I'm running Ubuntu on a Macbook Pro 2009 9dual core processor), and have found these two files to contain my two CPU core temperatures:

cpucoretemp0 -> /sys/devices/platform/coretemp.0/hwmon/hwmon[0-9]/temp2_input

cpucoretemp1 -> /sys/devices/platform/coretemp.0/hwmon/hwmon[0-9]/temp3_input

Solution 2

I use an alias to monitor temperature:

$ temp
INT3400 Thermal  20.0°C
SEN1             52.0°C
SEN2             50.0°C
SEN3             57.0°C
SEN4             60.0°C
B0D4             50.0°C
pch_skylake      81.5°C
x86_pkg_temp     50.0°C

Note: pch_skylake is the Thunderbolt port which for some reason is always out of wack. The bottom temperature x86_pkg_temp is the temperature I use for overall system temperature. The first four SEN temperatures (SEN1 through SEN4) are the CPU core temperatures (Intel Quad Cord i7-6700HQ processor).

You can mimic my temp alias by copying and pasting this line into the terminal:

paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'

Source: How do I get the CPU temperature?

Share:
8,038

Related videos on Youtube

Mads
Author by

Mads

Updated on September 18, 2022

Comments

  • Mads
    Mads over 1 year

    I'm new to ubuntu and I'm having some trouble with reading temperatures on my system. I've tried using lm-sensors and psensors by following some guides with no luck. Ive also tried hardinfo which seems really nice and useful, when I use it to monitor my cpy temps I get the following info:

    hardinfo sreenshot

    Note: The pc has no problems detecting the cores or cpu usage.

    When I run hardinfo from terminal I get this message as well:

    hardinfo terminal

    Related to the matter, but unrelated to ubuntu, the cpu temps on my computer runs really hot when I monitor it through the bios it goes from 35-45 celcius, I'm unsure if this is because the motherboard doesn't read the temperature right or if the cooler paste somehow was spread badly when I mounted my new cooler, it is a corsair 150i pro which comes with pre-applied cooler paste or lastly if the fans on it somehow doesn't spin fast enough (I'm assuming if the system cant read the cpu temperature it cant control the fan speed as necessary).

    I understand if the second part is in the wrong forum but I would appreciate if I could get help for both since I think the problems are related.

    Thanks in advance.

    Edit: I realized the temperature monitoring worked all along, it was just that it had(to me) a strange name - "k10temp_temp1" and there is, apparently, only 1 sensor on my cpu (ryzen 2700x) which was new to me coming from windows and intel.

    • Doug Smythies
      Doug Smythies over 5 years
      What processor make and model? Do: grep name /proc/cpuinfo
    • Mads
      Mads over 5 years
      Ryzen 2700x with asus rog strix b450-E gaming
    • Doug Smythies
      Doug Smythies over 5 years
      I'm not sure, but I think turbostat (linux-tools-common package) works with AMD Ryzen. Try it. Example sudo turbostat --Summary --quiet --show Busy%,Bzy_MHz,PkgTmp,PkgWatt --interval 15. By the way a processor temperature of 45 degrees is actually pretty good.
    • Mads
      Mads over 5 years
      I tried to run the command, it doesn't recognize it. Do I need to install it first? Maybe you're right I shouldn't be so worried about the temperature, it is just that it is the idle temperature and my room is like 18-20 celsius.
    • Doug Smythies
      Doug Smythies over 5 years
      Yes, you probably need to install it: sudo apt install linux-tools-common (I think).
    • Mads
      Mads over 5 years
      Its starting to print some stuff now.
    • Mads
      Mads over 5 years
      It prints the buzy and mhz but no temperatures
    • Mads
      Mads over 5 years
      I don't know if its related but the system seems a bit unstable, firefox crashes regularly, sometimes I get logged out, i can't tell whether thats because the pc restarts or just simply logs out since it "reloads" so fast - I'm using nvme.
    • Mads
      Mads over 5 years
      Reading around it would seem that i might need some "kernel module" but I have no knowledge about getting that.
    • karel
      karel over 5 years
      Possible duplicate of How do I get the CPU temperature?
  • Mads
    Mads over 5 years
    When I go to that directory theres no folders/files named coretemp
  • Mads
    Mads over 5 years
    Nevermind found it, it was named differently but there is no file named anything with temp or temperature
  • Mads
    Mads over 5 years
    I can find /sys/devices/platform/eeepc-wmi/hwmon/hwmon1 which contains fan1_input, fan1_label, name, pwm1_enable and uevent but no temp
  • JustinMT
    JustinMT over 5 years
    Go to /sys/devices/platform/ and search for "temp". The folder name is likely different for different hardware.
  • JustinMT
    JustinMT over 5 years
    My fan data is here: /sys/devices/platform/applesmc.768/fan2_output
  • Mads
    Mads over 5 years
    I looked around some more and found /sys/devices/platform/eeepc-wmi/hwmon/hwmon1/subsystem which contains hwmon0 and hwmon1. hwmon0 contains 2 temp files temp1_input and temp1_max, they contain some odd numbers however, like 40000 and 70000, am i supposed to divide by 1000 and thats the temperature?
  • Mads
    Mads over 5 years
    Shouldn't there also be 8 files since i have eight cores? only 1 shows up
  • JustinMT
    JustinMT over 5 years
    Yes, you divide by 1000.
  • JustinMT
    JustinMT over 5 years
    You may only have two temperature sensors, even though there are eight cores. You should be able to find the number of temperature sensors by googling you CPU specs.
  • JustinMT
    JustinMT over 5 years
    I suggest you also look in to how Linux sets your CPU clock speed. My apple has a 2.67 GHz processor, with discrete speed settings between 1.6 GHz and 3.1 GHz. Linux sets the speed to 3.1 GHz, which probably comes from the BIOS, and I'm guessing apple starts up with the higher speed for better start up time while not degrading the life of the CPU.
  • JustinMT
    JustinMT over 5 years
    I found my computer was hot because the CPU was always running too fast, so I wrote a bash script to set the CPU speed I want (& fan speed).
  • Mads
    Mads over 5 years
    You may be correct, it would seem that there is indeed only one sensor on my processor, so it was working all along. At the same time I found out that the temperature that I have to look for was labeled as k10temp/temp1 which confused me initially because to me (as a noob) the label didn't suggest that it was the cpu temp. It also shows much better temps now (maybe the bios doesn't use offset?) the idle temperature is more like 23-35 celcius now compared to 35-45 monitored in bios. I learn something new everyday :)
  • Mads
    Mads over 5 years
    However, I still can't monitor my fan speed as it just says it runs at 0 rpm permanently :/