在Linux中如何查看CPU和GPU的风扇速度

时间:2019-11-20 08:53:53  来源:igfitidea点击:

Linux如何查看CPU风扇速度?
如何检测CPU和GPU的风扇速度?

解决方案

Linux中有一个监控传感器的软件lm_sensors。它是一个开源软件,提供用于监视CPU/GPU温度,电压和风扇速度的命令和驱动程序。

如何安装lm传感器lm_sensors

在CentOS/RHEL/Oracle Linux中安装lm_sensors

使用yum命令,如下所示:

sudo yum install lm_sensors

在Fedora Linux上安装

输入dnf命令:

sudo dnf install lm_sensors

在Debian/Ubuntu/Mint Linux上安装

执行apt命令/apt-get命令:

sudo apt-get install lm-sensors

在OpenSuse/Suse Linux上安装

执行以下zypper命令:

sudo zypper in sensors

在Arch Linux上安装

执行pacman命令:

sudo pacman -S lm_sensors

设置lm-sensors

运行sensors-detect命令,检测并生成内核模块列表了。

sudo lm-sensors

所有的问题都直接回车。
将会创建一个文件/etc/sensors3.conf。
该文件用于加载Linux内核模块并在启动时自动启动服务。

cat /etc/sensors3.conf

输出示例:

# libsensors configuration file
# -----------------------------
#
# This default configuration file only includes statements which do not
# differ from one mainboard to the next. Only label, compute and set
# statements for internal voltage and temperature sensors are included.
#
# In general, local changes should not be added to this file, but rather
# placed in custom configuration files located in /etc/sensors.d. This
# approach makes further updates much easier.
#
# Such custom configuration files for specific mainboards can be found in
# "configs" directory of lm-sensors package.
#
# Please contribute back a configuration of your board so other users with
# the same hardware won't need to recreate it again and again.

chip "lm78-*" "lm79-*" "lm80-*" "lm96080-*"

    label temp1 "M/B Temp"

chip "w83792d-*"

    label in0 "VcoreA"
    label in1 "VcoreB"
    label in6 "+5V"
    label in7 "5VSB"
    label in8 "Vbat"

    set in6_min  5.0 * 0.90
    set in6_max  5.0 * 1.10
    set in7_min  5.0 * 0.90
    set in7_max  5.0 * 1.10
    set in8_min  3.0 * 0.90
    set in8_max  3.0 * 1.10

chip "w83793-*"

查看CPU风扇速度和其他信息

执行

sensors
sensors | grep -i fan

查看风扇速度:

watch -n1 -d sensors
watch -n1 -d 'sensors | grep fan'
watch -n1 -d 'sensors | egrep "fan|temp" | grep -v "0.0"'

图形化显示风扇速度

安装psensor:

sudo apt install psensor # Debian/Ubuntu
sudo zypper in psensor # Suse/OpenSUSE
sudo pacman -S psensor # Arch Linux
sudo yum install xsensors # CentOS/RHEL 

运行:

psensor

如果是centos/rhel ,则执行

xsensors

xsenors将显示wifi,gpu,cpu,风扇,电池和其他信息