如何在Ubuntu Linux上获得CPU温度
硬件过热通常会产生系统的不良性能。
监控硬件温度可以诊断系统的任何CPU过热问题。
笔记本电脑过热的来源通常来自广泛的CPU,GPU(视频卡)或者硬盘温度。
如果笔记本电脑变热,请确保笔记本电脑正确定位,因此它不会限制气流。
我们必须具有良好的,清洁的笔记本电脑冷却器,而不是尘土飞扬,并删除使用高CPU的任何不需要的软件。
同时在省电模式下运行笔记本电脑可减少过热。
在本教程中,我们将学习如何从命令行以及从桌面获取Ubuntu Linux上的CPU温度。
1)使用LM_Sensors检查CPU温度
LM_Sensors是一个命令行工具,用于显示所有芯片传感器数据的当前读数,包括CPU温度。
默认情况下,LM_SESENS未安装在大多数Linux发行版中,因此,我们必须自己安装它们。
所以首先让我们检查如何在各种Linux发行版上安装LM-Sensors包。
关于ubuntu/debian
从键盘上按快捷键Ctrl + Alt + T
打开Ubuntu上的终端。
然后通过运行我在Ubuntu 18.04,Ubuntu 20.04和Debian 10上测试的以下命令来安装LM_Sensensors:
$sudo apt install lm-sensors
如果要打印远程服务器的温度和风扇速度,请安装Psensor服务器。
$sudo apt-get install psensor-server
在Arch Linux上
要在Arch Linux上安装LM_Sensors,请在"/etc/pacman.conf"中启用另外的存储库。
然后从终端运行以下pacman命令:
$sudo pacman -S lm_sensors
在Fedora
使用dnf命令在Fedora Linux上安装LM_Sensors。
$sudo dnf install lm_sensors
在CentOS/RHEL
使用yum命令在CentOS 7和Rhel 7上安装LM_Sensors
$sudo yum install lm_sensors
检测Ubuntu Linux上的兼容传感器
接下来,我们需要检测安装在笔记本电脑中的硬件监控芯片。
所以现在我们可以开始检测我们的笔记本电脑硬件传感器。
这将提供有关的信息:
- 传感器嵌入在CPU和其他超级I/O芯片中
- 在我们的系统上通过I/O端口和SMBus/I2C总线访问的硬件监控芯片
我们通过键入命令sudo传感器来做 - 检测:
$sudo sensors-detect # sensors-detect revision 6284 (2014-05-31 14:00:33 +0200) # System: LENOVO 20FMS1W300 [ThinkPad T460] (laptop) # Kernel: 4.15.0-96-generic x86_64 # Processor: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (6/78/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 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 ..................
在命令行中显示CPU温度
我们已成功安装LM-Sensors包,我们已在Ubuntu Linux供电的笔记本电脑上成功检测到支持的传感器。
现在我们可以执行以下命令以查看温度数据:
sensors
请注意,结果对计算机有所不同。
$sensors iwlwifi_1-virtual-0 Adapter: Virtual device temp1: +33.0°C pch_skylake-virtual-0 Adapter: Virtual device temp1: +38.5°C BAT0-acpi-0 Adapter: ACPI interface in0: +12.45 V coretemp-isa-0000 Adapter: ISA adapter Package id 0: +39.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +39.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +38.0°C (high = +100.0°C, crit = +100.0°C) thinkpad-isa-0000 Adapter: ISA adapter fan1: 0 RPM temp1: +38.0°C temp2: N/A temp3: +0.0°C temp4: +0.0°C temp5: +0.0°C temp6: +0.0°C temp7: +0.0°C temp8: +0.0°C BAT1-acpi-0 Adapter: ACPI interface in0: +12.49 V acpitz-acpi-0 Adapter: ACPI interface temp1: +38.0°C (crit = +128.0°C)
我们还可以使用Watch命令不断运行Sensors命令,这将在屏幕上显示传感器输出变化:
$watch sensors
2)使用Psensor GUI工具检查CPU温度
我们将使用GUI工具Psensor,它允许我们监控Linux上的硬件温度。
使用Psensor我们可以查看以下内容:
- 主板和CPU传感器的温度和NVIDIA GPU
- 硬盘驱动器的温度
- 风扇的旋转速度
- 监控CPU使用率
最新版本的PSensor还为Ubuntu提供了一个小程序指示器,因此它会在Ubuntu上监控硬件温度甚至更容易。
我们可以选择在顶面板本身中显示温度。
当温度超过极限时,它甚至可以发送桌面通知。
我们可以使用以下命令进行Psensor的安装:
Ubuntu/Debian.
$sudo apt install psensor
Fedora.
$sudo dnf install https://raw.githubusercontent.com/rpmsphere/x86_64/master/p/psensor-1.2.0-5.1.x86_64.rpm
CentOS和Rhel.
$sudo yum install https://raw.githubusercontent.com/rpmsphere/x86_64/master/p/psensor-1.2.0-5.1.x86_64.rpm
安装后,通过在Unity Dashboard中查找它来运行应用程序。
在第一次运行时,我们可以配置要与Psensor收集的统计数据(传感器)。
如果要显示顶板中包含温度的CPU统计信息,请转到"传感器首选项"。
然后在"应用程序指示符"菜单下,选择要为其显示温度的组件。
然后检查标签选项中的"显示传感器"。
3)使用"HardInfo"检查CPU温度
HardInfo是在Linux中使用的系统分析器和基准工具,以显示GUI中的硬件信息。
我们还可以从GUI设备传感器检查CPU温度。
在Ubuntu和Debian上
$sudo apt install hardinfo
在Arch Linux上,我们可以在社区Repo中找到HardInfo
$sudo pacman -S hardinfo
从终端运行以下命令以显示GUI的硬件信息。
# hardinfo
使用"i7z"找到CPU温度
I7Z是一个命令行工具,用于打印Intel Core i7,I5,I3处理器的CPU信息,并报告CPU温度。
i7z需要用sudo权限作为root或者用户运行。
要在Ubuntu上安装,请执行以下命令:
$sudo apt install i7z