linux获取CPU温度

时间:2021-12-02 08:34:48

Centos系列

1 yum install lm_sensors
2 sensors-detect
3 sensors

Ubuntu系列(多了service module-init-tools start一步骤)

1 apt-get install lm-sensors
2 sensors-detect
3 service module-init-tools start
4 sensors

也可以通过sys系统读取cpu的温度: /sys/class/hwmon/hwmon0/device/

参考:http://www.mjmwired.net/kernel/Documentation/thermal/sysfs-api.txt