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
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
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.