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?

1 Answer 1

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
  • I know that they're the same sensor. I just don't know why there would be two files for the output. Commented Feb 25, 2016 at 6:44
  • 1
    They are just links to the same place. This is usually for compatibility with other distributions or previous usage.
    – Milliways
    Commented Feb 25, 2016 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.