ubuntu如何查看cpu温度

Ubuntu12.10怎么查看CPU温度

在计算机运行过程中,CPU的温度是一个非常重要的参数,过高的CPU温度可能会导致系统不稳定,甚至损坏硬件,了解CPU的温度对于保持计算机稳定运行非常重要,本文将介绍如何在Ubuntu 12.10系统中查看CPU温度。

ubuntu如何查看cpu温度

安装lm-sensors工具

在Ubuntu系统中,我们可以使用lm-sensors工具来检测CPU温度,首先需要安装lm-sensors工具,打开终端,输入以下命令:

sudo apt-get update
sudo apt-get install lm-sensors

安装完成后,重启计算机。

加载内核模块

重启后,我们需要加载内核模块以启用传感器支持,在终端中输入以下命令:

sudo sensors-detect

按照提示操作,最后会询问是否要将检测到的模块添加到/etc/modules文件中,如果需要,请输入“yes”。

ubuntu如何查看cpu温度

查看CPU温度

加载内核模块后,我们就可以使用sensors命令查看CPU温度了,在终端中输入以下命令:

sensors

执行该命令后,终端会显示当前系统中所有传感器的信息,包括CPU温度。

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +36.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:       +34.0°C  (high = +87.0°C, crit = +105.0°C)
...

从输出结果中,我们可以看到每个核心的温度,请注意,这些温度值是摄氏度,如果需要查看其他单位的温度值,可以使用以下命令:

sensors -f | grep "Core 0" | awk '{print $3}' | xargs printf "%d.%d
" $(echo "$(cat /sys/class/thermal/thermal_zone0/temp) / 1000" | bc)

设置报警阈值

为了确保计算机在高负载运行时不会过热,我们可以设置一个报警阈值,当CPU温度超过这个阈值时,系统会发出警告,在终端中输入以下命令:

ubuntu如何查看cpu温度

sudo sensorsctl coretemp-isa-0000 set alarm-low 45 && sudo sensorsctl coretemp-isa-0000 set alarm-high 95

上述命令将设置CPU温度的低报警阈值为45摄氏度,高报警阈值为95摄氏度,当温度超过这两个阈值时,系统会发出警告。

监控CPU温度

除了手动查看CPU温度外,我们还可以使用一些图形化工具来实时监控CPU温度,可以使用lm_sensors软件包中的hwinfo工具,首先安装hwinfo工具:

sudo apt-get install hwinfo --no-install-recommends

安装完成后,运行hwinfo工具:

hwinfo --sensors=coretemp-isa-0000,temp1_input,temp2_input,temp3_input,temp4_input,temp5_input,temp6_input,temp7_input,temp8_input,temp9_input,temp10_input,temp11_input,temp12_input,temp13_input,temp14_input,temp15_input,pch_temp1,pch_temp2,pch_temp3,pch_temp4,pch_temp5,pch_fan1,pch_fan2,pch_fan3,pch_fan4,pch_fan5,pch_fan6,pch_fan7,pch_fan8,pch_fan9,pch_fan10,pch_fan11,pch_fan12,pch_fan13,pch_fan14,pch_fan15,in0_input,in1_input,in2_input,in3_input,in4_input,in5_input,in6_input,in7_input,in8_input,in9_input,in10_input,in11_input,in12_input,in13_input,in14_input,in15_input --scan | grep "Core" --line-number | cut -d':' -f 1 | sort | uniq | while read line; do echo -n "Core $line: "; cat /sys/class/thermal/thermal_zone$line/temp; done | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' | column -t -s ' ' -o ' ' -N r | head -n 26 | tail -n 24 | tr '
' ' ' | awk '{print $2}' | xargs -I{} printf "%d.%d C " {} | awk '{print $1}' > ~/Desktop/cputemp.txt & disown %+ 将输出重定向到桌面文件并后台运行& watch cat ~/Desktop/cputemp.txt 每隔两秒刷新一次桌面文件& disown %+ 结束后台进程& clear 清除屏幕内容注意:以上命令需要在终端中运行,并且需要root权限才能访问某些目录和文件,由于不同的硬件配置和驱动程序可能会影响输出结果,因此建议根据实际情况调整命令中的参数和选项。

原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/198660.html

(0)
K-seoK-seoSEO优化员
上一篇 2024年1月4日 23:51
下一篇 2024年1月4日 23:52

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

免备案 高防CDN 无视CC/DDOS攻击 限时秒杀,10元即可体验  (专业解决各类攻击)>>点击进入