第一种方式:直接获取
1.获取cpu温度传感器thermal原始值,除以1000是真正的温度
cat /sys/class/thermal/thermal_zone0/temp
43000
2.转换成实际温度
echo $[$(cat /sys/class/thermal/thermal_zone0/temp)/1000]°
43
第二种方式:借助工具lm-sensors
安装lm-sensors
sudo apt install lm-sensors
获取cpu所有核和硬盘的温度
root@szf:/home/szf/桌面# sensors
nouveau-pci-0100
Adapter: PCI adapter
temp1: N/A (high = +95.0°C, hyst = +3.0°C)
(crit = +105.0°C, hyst = +5.0°C)
(emerg = +135.0°C, hyst = +5.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +44.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +40.0°C (high = +100.0°C, crit = +100.0°C)
Core 4: +44.0°C (high = +100.0°C, crit = +100.0°C)
Core 8: +44.0°C (high = +100.0°C, crit = +100.0°C)
Core 12: +42.0°C (high = +100.0°C, crit = +100.0°C)
Core 16: +38.0°C (high = +100.0°C, crit = +100.0°C)
Core 20: +41.0°C (high = +100.0°C, crit = +100.0°C)
Core 24: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 25: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 26: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 27: +39.0°C (high = +100.0°C, crit = +100.0°C)
Core 28: +40.0°C (high = +100.0°C, crit = +100.0°C)
Core 29: +40.0°C (high = +100.0°C, crit = +100.0°C)
Core 30: +40.0°C (high = +100.0°C, crit = +100.0°C)
Core 31: +40.0°C (high = +100.0°C, crit = +100.0°C)
nvme-pci-0400
Adapter: PCI adapter
Composite: +36.9°C (low = -273.1°C, high = +80.8°C)
(crit = +84.8°C)
Sensor 1: +36.9°C (low = -273.1°C, high = +65261.8°C)
Sensor 2: +35.9°C (low = -273.1°C, high = +65261.8°C)
BAT0-acpi-0
Adapter: ACPI interface
in0: 11.81 V
ucsi_source_psy_USBC000:001-isa-0000
Adapter: ISA adapter
in0: 0.00 V (min = +0.00 V, max = +0.00 V)
curr1: 3.00 A (max = +0.00 A)
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1: +40.0°C
thinkpad-isa-0000
Adapter: ISA adapter
fan1: 0 RPM
CPU: +44.0°C
GPU: N/A
temp3: +38.0°C
temp4: +0.0°C
temp5: +40.0°C
temp6: +36.0°C
temp7: +39.0°C
temp8: N/A
nvme-pci-0500
Adapter: PCI adapter
Composite: +36.9°C (low = -273.1°C, high = +80.8°C)
(crit = +84.8°C)
Sensor 1: +36.9°C (low = -273.1°C, high = +65261.8°C)
Sensor 2: +38.9°C (low = -273.1°C, high = +65261.8°C)
acpitz-acpi-0
Adapter: ACPI interface
temp1: +44.0°C (crit = +128.0°C)
(1)nouveau-pci-0100:这是一个PCI适配器的温度传感器。在这个示例中,传感器未提供温度数据。
(2)coretemp-isa-0000:这是一个ISA适配器的温度传感器,通常用于Intel处理器。以下是针对不同核心的温度读数:
Package id:处理器的整体温度。
Core 0、Core 4、Core 8等:不同处理器核心的温度读数。对于每个核心,提供了三个阈值:
high:高温警告阈值。当温度达到此阈值时,系统可能会发出警告。
crit:临界温度阈值。当温度达到此阈值时,系统可能会采取措施以防止过热。
emerg:紧急情况温度阈值。当温度达到此阈值时,系统可能会采取紧急措施以防止损坏。
(3)nvme-pci-0400:这是一个PCI适配器的温度传感器,用于监测NVMe设备的温度(即SSD硬盘温度)。以下是该传感器的温度读数:
Composite:综合温度读数,代表多个传感器的平均值。
Sensor 1、Sensor 2:单独的传感器读数。
(4)BAT0-acpi-0:这是一个ACPI接口适配器,用于监测电池的电压。在这个示例中,电池的电压为11.81伏特。
(5)ucsi_source_psy_USBC000:001-isa-0000:这是一个ISA适配器,用于监测USB-C电源适配器的电压和电流。在这个示例中,电压为0伏特,电流为3安培。
(6)iwlwifi_1-virtual-0:这是一个虚拟设备适配器,用于监测无线网卡的温度。在这个示例中,温度为40摄氏度。
(7)thinkpad-isa-0000:这是一个ISA适配器,用于监测ThinkPad笔记本电脑的各个部件的温度和风扇转速。以下是提供的温度读数:
fan1:风扇转速,0 RPM表示风扇处于停止状态。
CPU:处理器的温度。
GPU:显卡的温度。
temp3、temp4、temp5、temp6、temp7、temp8:其他设备或传感器的温度读数。
(8)nvme-pci-0500:这是一个PCI适配器,用于监测NVMe设备(一种高性能存储设备)的温度。以下是该传感器的温度读数:
Composite:综合温度读数,代表多个传感器的平均值。
Sensor 1、Sensor 2:单独的传感器读数。
(9)acpitz-acpi-0:这是一个ACPI接口适配器,用于监测系统的温度。在这个示例中,温度为44摄氏度,临界温度为128摄氏度。
更多精彩文章,请扫码关注微信公众号