I'm running sensors-detect on my system with lm-sensors because my system keep shutting down when I watch youtube videos

So I'm wondering how can I find the temperatures of the fan and cpu manually without a 3rd party software like lm-sensors? I'm just not sure where they're stored.

processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 16
model       : 6
model name  : AMD Athlon(tm) II X2 240e Processor
power management: ts ttp tm stc 100mhzsteps hwpstate


  • What version of Ubuntu are you running? – wjandrea Jul 24 '18 at 21:50
  • 1
    It depends on your processor. For many recent Intel processors the turbostat program will read the MSRs (Machine Specific Registers) and display the package and core temperatures. Edit your question and add your processor make an model. If it is one that I know, I'll answer with how to do it manually. – Doug Smythies Jul 24 '18 at 21:50
  • would the additional RAM i added have a problem.., RAM is 1333 megatransfers per second, and cpu is max MHz: 2800.0000 – user610658 Jul 24 '18 at 22:14
  • I do not know the specific MSRs for that processor. Suggest to try turbostat, just to know if it knows about it. If you want, I can write an answer with how I do it manually for Intel processors. – Doug Smythies Jul 24 '18 at 22:15
  • 11
    What do you mean by third-party? How much of Ubuntu do you think is first-party software? – muru Jul 25 '18 at 0:13

It sounds like what you want is /sys/class/hwmon and /sys/class/thermal.

Both of these provide simple shell based access to the data you want (the hwmon directory will also include other sensor types). Each has one directory for each sensor interface in your system (which may have more than one sensor).

Three other things to note though:

  • Unless you have a really bad system, running the sensors command even once a second shouldn't have any percievable effect. In fact, regularly reading the files in the above mentioned directories may have more of an effect.
  • Graphs are your friend here. I would suggest getting something like netdata or collectd running so you have realtime (or near realtime) data to look at.
  • Check your voltages too. What your describing could also be due to having a power supply that can't keep up with your system's power requirements. This will be indicated by voltages dropping significantly when the system is under high load.
  • This should be the accepted answer, because it deals with the actual question asked: "how can I find the temperatures [...] manually [...]? I'm just not sure where they're stored." Then some /proc/cpuinfo showing an AMD processor. Not sure why OP then accepted an Intel-specific answer which requires another tool to be installed. – Aaron F Jul 25 '18 at 12:04
  • @AaronF : I don't disagree. I wrote an Intel specific answer because the OP asked me to. No other tool needs to be installed? The reason I read package temperatures directly via MSRs rather than via /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input is that most of my work is with extremely idle systems, and the latter method has a lot more overhead, resulting in a consistent 4 to 5 degrees higher result. Of course, there is no difference for a heavily loaded system. – Doug Smythies Jul 25 '18 at 12:46
  • 1
    @DougSmythies I thought your answer was very good and complete, which is why I didn't downvote nor leave a negative comment beneath it :-) The rdmsr program is part of msr-tools, which isn't installed by default on my Intel machine (running Ubuntu, maybe other distros install by default if they detect Intel?) – Aaron F Jul 25 '18 at 15:50
  • @AaronF : I forgot that msr-tools is a needed additional package. So my method also needs and additional tool, which is not what the OP wanted. – Doug Smythies Jul 25 '18 at 15:52
  • 2
    Hello @ DougSmythies and Aaron F, I had originally chose DougSmythies as the primary answer because he was the first to provide assistance and his answer was very clear on how to search for the Temperature manually as well as using the manual solution into an easy to use program with mdmsr support, It was in fact a hard decesion as both answers were very informative, But since you both agreed that this answer was the best. I reverted the primary answer to Aaron, thank you for your support. Happy hunting – user610658 Jul 28 '18 at 10:46

This answer is about one way to monitor processor temperature manually for some Intel processors via accessing the Machine Specific Registers (MSR) directly.

The first thing to note is, in this case, what is read out of the MSR is relative to the Tcc, the limit temperature, so an additional calculation is required to determine the actual temperature.

Refer to the Intel® 64 and IA-32 Architectures Software Developer’s Manual, or in your case the AMD equivalent.

In my case, I want bits 22-16 of the MSR at 0x1B1, aka IA32_PACKAGE_THERM_STATUS. The Tcc for my older i7-2600K is 98 degrees.

Here is a simple script to monitor the temperature (and CPU frequency) manually:

#! /bin/dash
# temp_mon3 Smythies 2016.10.05
#       a simplified version of temp_mon2,
#       for monitoring temp.
#       Note: it is on purpose that -a is not used.
#       Also CPU0 frequency (1 is good enough, when all
#       are loaded).
# temp_mon2 Smythies 2016.09.29
#       Monitor Package temperatures.
#       Use clock modulation to control temps.
#       i.e. simulate the second to last level
#       of defense.
#       Use simple primatives.
#       run as sudo
#       hardcoded for my tcc of 98 degrees.
echo ... begin package temperature monitoring ...

# In case I forgot (which I often do)

modprobe msr

# first let the drastic effect of the sudo command decay
# Done later in temp_mon3.

# some stuff

COMMAND="rdmsr --bitfield 22:16 -u 0x1B1"
COMMAND2="cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq"

# then get on with it

while [ 1 ];do
  sleep 4
  CPU0_FREQ=$(eval $COMMAND2)
  echo "$TEMP_ACT   $CPU0_FREQ"

And here is some sample output, where I add some CPU load after awhile (temp goes from 31 to 73 degrees):

$ sudo ./temp_mon3
[sudo] password for doug:
... begin package temperature monitoring ...
31   1605275
31   1605154
32   1605164
30   1605148
31   1605176
51   3511279
54   3511278
55   3511279
57   3511283
58   3511279
60   3511278
61   3511284
63   3511279
64   3511280
64   3511280
66   3511280
67   3511278
68   3511280
68   3511281
69   3511278
71   3511280
70   3511281
71   3511281
71   3511280
72   3511276
72   3511277
73   3511283
73   3511279
  • Why do you use eval? – wjandrea Jul 24 '18 at 22:48
  • @Doug: Great answer to use msr! However, isn't the right msr register 0x19c ? And the temperature is TEMP= TCC - [0x19c bits 22:16] . So it is necessary to read the TCC first. – abu_bua Jul 25 '18 at 0:38
  • @abu_bua : I don't know if 0x19c works or not, but what I am using does. And yes, I hardcoded TCC for my processor rather than the better solution which would be to read it from the processor. – Doug Smythies Jul 25 '18 at 1:44
  • 1
    did you installed sudo apt install msr-tools? – abu_bua Jul 25 '18 at 15:39
  • 1
    msr-tools is the package. It would be man rdmsr and man wrmsr for two of the individual commands within the package. – Doug Smythies Jul 25 '18 at 21:52

I don't know what you really want. The lm-sensor program (and therefore the sensors command) make use of the libsensor library; in case you use Ubuntu 18.04 it is libsensors4, version 3.4.0-4. This is the same library which reads the temperature as can be seen in the sysdirectory.

To sum it up, sensors is a good choice. To watch the temperature continuously use

watch -n 1 sensors

If you want to write a program, you have to take a look at libsensors with man libsensorsor take a look in the /usr/share/doc/. You have to include #include <sensors/sensors.h>. It will use the sensors.conffiles /etc/sensors3.conf and/or /etc/sensors.conf. Further (users) configuration can be found in /etc/sensors.d/, if used.

If you think that you are missing some sensors take a look at the /sys/class/thermal or the linked /sys/devices/virtual/thermal directory.

To get the temperatures of the all thermal zones use

$ cat /sys/devices/virtual/thermal/thermal_zone?/temp


The temperature is measured in miliCelcius (mC), in the case above 77.0, 66.0, 67,0 °C.

To watch continously use

watch -n 1 cat /sys/devices/virtual/thermal/thermal_zone?/temp

In this directory you can also find information about your cooling (fan) devices, and how the PID regulators are programmed.

I would also like to state that some overtemperature protection is coded very hardware based (this is a good idea), where the data is placed in your bios.

  • i know there's programs, but i was looking for a way to manually find th etemps – user610658 Jul 24 '18 at 21:59
  • 1
    What do you mean by manually? All that things that prints the temperature are programs. – abu_bua Jul 25 '18 at 18:46
  • i don't have a thermal_zone, all i have are cooling_device0 1 and 2 but they dont hold a file temp, only cur_state device max_state power subsystem type uevent – user610658 Jul 25 '18 at 21:49
  • cur and max state are 0 and 10 – user610658 Jul 25 '18 at 21:50

Install Psensor (psensor) from the default Ubuntu repositories and configure Psensor to automatically play an alert sound whenever the temperature goes above a user determined maximum. The purpose of this is to let you hear a warning sound before your system shuts down without adding additional application overhead to your system.

Psensor displays itself on the desktop as a little thermometer icon in the notification area in the upper right corner of the desktop next to the clock. You can right-click the thermometer icon at any time to display the hardware temperatures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy