How can I get the current temperature of the CPU on Linux?
There are several questions and answers on getting the CPU temperature using C#, but all of them seem to be Windows specific.
If you know how to read a file in C# , and your computer is ACPI enabled, you may be able to read a file
/proc/acpi/thermal_zone/THRM/temperature
on other linux flavors it might be
/proc/acpi/thermal_zone/THM0/temperature
You would have to run this using mono on linux of course.
using System;
using System.IO;
using System.Text;
class Test
{
public static void Main()
{
string path = @"/proc/acpi/thermal_zone/THRM/temperature";
if (!File.Exists(path))
{
Console.WriteLine("Could not find "+path);
return;
}
string readText = File.ReadAllText(path);
Console.WriteLine(readText);
}
}
Without C#, you can use this command:
sudo sensors
Labels used in the output can be found in /etc/sensors3.conf