This may be equivalent to what Gnome and/or lm-sensors uses, but then maybe not. To be honest, I'm pretty uninformed about the details of this issue; mostly I just know how to root around for stuff, and know where the temperature info is usually at and what it looks like.
On my Dell (a trooper pentium M laptop from about 6 years ago),
$ cat /sys/devices/virtual/thermal/thermal_zone0/temp
will print the current temperature in thousandths of degrees Celsius. This particular location is I think the standard one, though there are others. For instance, it's also available at /sys/devices/virtual/hwmon/hwmon0/temp1_input
. I'm not sure if this is the same sensor or not.
If that doesn't work, you could try
$ find /sys -iname "*temp*" -or -iname "*ther*"
for a fairly brute-squad approach (*ther*
will catch "thermal" and generally not much else).
If you don't find it that way, I guess you could be the brute squad and do something like
$ find /sys/ -type f | while read f; do
if grep -q '^[0-9]\{5\}$' $f
&& (( $(wc -l $f | cut -f 1 -d \ ) == 1 ));
then
echo $f;
fi;
done 2>/dev/null;
which should print out all files that are one line long and consist of 5 digits, which is generally how these pseudo-files look.
If you don't find it, you can broaden the search a bit by changing \{5\}
to \+
to find any number of digits, and/or adding a .
after the 9
in the character range [0-9]
. Doing both of those will let you catch floating-point representations, though it seems very unlikely that they'd be doing it that way.
I'm not sure how useful either of these approaches will be, since the information may not be in sysfs (ie /sys/...
) at all. You might be able to find it under /proc/
instead, using similar techniques — but filter out the numbered directories, and /proc/self
, or you'll end up searching metadata for all the processes on your system.