How to Check CPU And Hard Disk Temperature on Linux
如果您想检查硬件运行状况,例如CPU温度,硬盘温度,风扇速度等。 我建议您使用lm_sensors和hddtemp。
lm_sensors(Linux监视传感器)是一个免费的开源应用程序,它提供用于监视温度,电压和风扇的工具和驱动程序。
它是一个CLI实用程序,如果您正在寻找替代工具。 我建议您使用s-tui:Stress Terminal UI是用于监视计算机的终端UI。
传感器用于显示所有传感器芯片的当前读数。
sensor -s用于设置配置文件中指定的所有限制。
sensors –bus-list用于生成适合配置文件的总线语句。
sensors-detect是一个交互式程序,它将引导您完成系统扫描各种硬件监视芯片或传感器的过程,这些程序由libsensors支持,或更常见的是由lm_sensors工具套件支持。
sensor-detect将按顺序查找以下设备:
嵌入在超级I / O芯片中的传感器。
通过ISA I / O端口访问的硬件监视芯片。
硬件监视芯片可通过SMBus或更常见的系统上的任何I2C总线访问。
hddtemp将通过阅读支持此功能的驱动器上的自我监控分析和报告技术(S.M.A.R.T.)信息来为您提供硬盘驱动器的温度。
仅现代硬盘驱动器具有温度传感器。 hddtemp支持阅读S.M.A.R.T. 来自SCSI驱动器的信息也是如此。hddtemp可以用作简单的命令行工具或守护程序。
这些工具提供了一些基本的命令行实用程序,用于监视这些设备。 此外,它还可以帮助您找出系统上有缺陷的硬件组件。
如何在Linux中安装lm_sensor和hddtemp
在Linux中有多种安装lm_sensor和hddtemp的方法,具体取决于您使用的Linux发行版。
大多数Linux发行版官方存储库中都提供预构建的软件包,因此,请使用适当的发行版Package Manager进行安装。
对于
1 | $ sudo dnf install lm-sensors hddtemp |
对于
1 | $ sudo apt install lm-sensors hddtemp |
对于基于
1 | $ sudo pacman -S lm-sensors hddtemp |
对于
1 | $ sudo yum install lm-sensors hddtemp |
对于
1 | $ sudo zypper sensors hddtemp |
如何在Linux中配置lm传感器
安装后,运行以下命令在Linux中配置lm-sensors。 在系统上配置光传感器时,它会提示您多次确认,并且对所有人简单地回答"是"。
sensors-detect将生成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | $ sudo sensors-detect # sensors-detect revision $Revision$ # System: LENOVO 80NV [Lenovo ideapad Y700-15ISK] (laptop) # Board: LENOVO Allsparks 5A # Kernel: 4.19.6-1-MANJARO x86_64 # Processor: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (6/94/3) This program will help you determine which kernel modules you need to load to use lm_sensors most effectively. It is generally safe and recommended to accept the default answers to all questions, unless you know what you're doing. Some south bridges, CPUs or memory controllers contain embedded sensors. Do you want to scan for them? This is totally safe. (YES/no): YES Module cpuid loaded successfully. Silicon Integrated Systems SIS5595... No VIA VT82C686 Integrated Sensors... No VIA VT8231 Integrated Sensors... No AMD K8 thermal sensors... No AMD Family 10h thermal sensors... No AMD Family 11h thermal sensors... No AMD Family 12h and 14h thermal sensors... No AMD Family 15h thermal sensors... No AMD Family 16h thermal sensors... No AMD Family 17h thermal sensors... No AMD Family 15h power sensors... No AMD Family 16h power sensors... No Intel digital thermal sensor... Success! (driver `coretemp') Intel AMB FB-DIMM thermal sensor... No Intel 5500/5520/X58 thermal sensor... No VIA C7 thermal sensor... No VIA Nano thermal sensor... No Some Super I/O chips contain embedded sensors. We have to write to standard I/O ports to probe them. This is usually safe. Do you want to scan for Super I/O sensors? (YES/no): YES Probing for Super-I/O at 0x2e/0x2f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... No Trying family `VIA/Winbond/Nuvoton/Fintek'... No Trying family `ITE'... No Probing for Super-I/O at 0x4e/0x4f Trying family `National Semiconductor/ITE'... Yes Found unknown chip with ID 0x8371 Some hardware monitoring chips are accessible through the ISA I/O ports. We have to write to arbitrary I/O ports to probe them. This is usually safe though. Yes, you do have ISA I/O ports even if you do not have any ISA slots! Do you want to scan the ISA I/O ports? (YES/no): YES Probing for `National Semiconductor LM78' at 0x290... No Probing for `National Semiconductor LM79' at 0x290... No Probing for `Winbond W83781D' at 0x290... No Probing for `Winbond W83782D' at 0x290... No Lastly, we can probe the I2C/SMBus adapters for connected hardware monitoring devices. This is the most risky part, and while it works reasonably well on most systems, it has been reported to cause trouble on some systems. Do you want to probe the I2C/SMBus adapters now? (YES/no): YES Using driver `i2c-i801' for device 0000:00:1f.4: Sunrise Point-H (PCH) Module i2c-dev loaded successfully. Next adapter: SMBus I801 adapter at 6040 (i2c-0) Do you want to scan it? (YES/no/selectively): YES Next adapter: i915 gmbus dpc (i2c-1) Do you want to scan it? (yes/NO/selectively): YES Next adapter: i915 gmbus dpb (i2c-2) Do you want to scan it? (yes/NO/selectively): yes Next adapter: i915 gmbus dpd (i2c-3) Do you want to scan it? (yes/NO/selectively): yes Next adapter: DPDDC-A (i2c-4) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0000 (i2c-5) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0001 (i2c-6) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0002 (i2c-7) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0005 (i2c-8) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0006 (i2c-9) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0007 (i2c-10) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0008 (i2c-11) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-bus-0009 (i2c-12) Do you want to scan it? (yes/NO/selectively): yes Next adapter: nvkm-0000:01:00.0-aux-000a (i2c-13) Do you want to scan it? (yes/NO/selectively): yes Client found at address 0x18 Probing for `Analog Devices ADM1021'... No Probing for `Analog Devices ADM1021A/ADM1023'... No Probing for `Maxim MAX1617'... No Probing for `Maxim MAX1617A'... No Probing for `Maxim MAX1668'... No Probing for `Maxim MAX1805'... No Probing for `Maxim MAX1989'... No . . Probing for `Fintek F75121R/F75122R/RG (VID+GPIO)'... No Probing for `Fintek F75111R/RG/N (GPIO)'... No Probing for `ITE IT8201R/IT8203R/IT8206R/IT8266R'... No Client found at address 0x77 Probing for `Asus Mozart-2'... No Now follows a summary of the probes I have just done. Just press ENTER to continue: Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9) Do you want to generate /etc/conf.d/lm_sensors? (YES/no): YES Created symlink /etc/systemd/system/multi-user.target.wants/lm_sensors.service → /usr/lib/systemd/system/lm_sensors.service. Unloading i2c-dev... OK Unloading cpuid... OK |
执行以下命令,查看CPU温度。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $ sensors nouveau-pci-0100 Adapter: PCI adapter GPU core: +0.60 V (min = +0.60 V, max = +1.20 V) temp1: -0.0°C (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: +35.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +33.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +35.0°C (high = +100.0°C, crit = +100.0°C) Core 2: +33.0°C (high = +100.0°C, crit = +100.0°C) Core 3: +32.0°C (high = +100.0°C, crit = +100.0°C) |
打印华氏温度而不是摄氏温度。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $ sensors -f nouveau-pci-0100 Adapter: PCI adapter GPU core: +0.60 V (min = +0.60 V, max = +1.20 V) temp1: +32.0°F (high = +203.0°F, hyst = +37.4°F) (crit = +221.0°F, hyst = +41.0°F) (emerg = +275.0°F, hyst = +41.0°F) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +96.8°F (high = +212.0°F, crit = +212.0°F) Core 0: +95.0°F (high = +212.0°F, crit = +212.0°F) Core 1: +95.0°F (high = +212.0°F, crit = +212.0°F) Core 2: +91.4°F (high = +212.0°F, crit = +212.0°F) Core 3: +91.4°F (high = +212.0°F, crit = +212.0°F) |
显示硬盘温度。
1 2 | $ sudo hddtemp /dev/sda2 /dev/sda2: WDC WD10SPCX-24HWST1: 32°C |
在Linux中安装Psensor
psensor是Linux的图形硬件温度监视器。 该应用程序设计为简单易用。 CPU和内存消耗不大。
它可以监视:
主板和CPU传感器(使用流明传感器)的温度。
NVidia GPU的温度(使用XNVCtrl)。
ATI / AMD GPU的温度(在官方发行版本存储库中未启用,请参见有关启用其支持的说明)。
硬盘驱动器的温度(使用hddtemp或libatasmart)。
风扇的转速(使用流明传感器)。
CPU使用率(自0.6.2.10起并使用Gtop2)。