To read the temperature in Raspbian (and most other systems) you can read the file /sys/class/thermal/thermal_zone0/temp, which will output the temperature in millicelsius, like this:

pi@raspberrypi0 ~ $ cat /sys/class/thermal/thermal_zone0/temp 

There is also a file, /sys/class/thermal/thermal_zone0/subsystem/thermal_zone0/temp which works exactly the same way, and outputs the exact same numbers.

So my question is: Why the different location? What meaning does the extra directory /subsystem/ have?

lrwxrwxrwx 1 root root 0 2016-02-19 22:24 thermal_zone0 -> ../../devices/virtual/thermal/thermal_zone0

lrwxrwxrwx 1 root root 0 2016-02-25 17:31 /sys/class/thermal/thermal_zone0/subsystem/thermal_zone0 -> ../../devices/virtual/thermal/thermal_zone0
|improve this answer|||||
  • I know that they're the same sensor. I just don't know why there would be two files for the output. – Patrick Cook Feb 25 '16 at 6:44
  • They are just links to the same place. This is usually for compatibility with other distributions or previous usage. – Milliways Feb 25 '16 at 6:46

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.