学而实习之 不亦乐乎

Linux 中 sensors 命令用法

2023-03-29 19:44:04

一、安装 lm_sensors

# yum -y install lm_sensors  

##接着执行 sensors-detect 命令,一路yes到底即可

选项

Usage: sensors [OPTION]... [CHIP]...
  -c, --config-file     Specify a config file
  -h, --help            Display this help text
  -s, --set             Execute `set' statements (root only)
  -f, --fahrenheit      Show temperatures in degrees fahrenheit
  -A, --no-adapter      Do not show adapter for each chip
      --bus-list        Generate bus statements for sensors.conf
  -u                    Raw output (debugging only)
  -v, --version         Display the program version

Use `-' after `-c' to read the config file from stdin.
If no chips are specified, all chip info will be printed.
Example chip names:
        lm78-i2c-0-2d   *-i2c-0-2d
        lm78-i2c-0-*    *-i2c-0-*
        lm78-i2c-*-2d   *-i2c-*-2d
        lm78-i2c-*-*    *-i2c-*-*
        lm78-isa-0290   *-isa-0290
        lm78-isa-*      *-isa-*
        lm78-*

二、sensors 列子

1、查看温度

# sensors
coretemp-isa-0003
Adapter: ISA adapter
Core 0:      +36.0°C  (high = +85.0°C, crit = +95.0°C)  

2、风扇调速

【1】主板 BIOS 中 FAN Control 选项设置成 Disable

【2】根据 sensors 检测到风扇连接的接口,向相应 pwm 文件输入值进行控制。

如:

# echo "100">/sys/class/hwmon/hwmon0/device/pwm1 
或者
# echo "255">/sys/class/hwmon/hwmon0/device/pwm1 

可以使风扇转速