fancontrol Command in Linux
The Linux fancontrol command regulates the fan speed based on system temperature. It controls the pulse width modulation (PWM) based on the temperature reading provided by the sensor.
Controlling the system fan allows you to improve the hardware performance. Although most modern systems automatically control fan speed, manually managing the fan speed can help improve thermal management, enhance system stability, and reduce fan noise.
Table of Contents
Here is a comprehensive guide to the options available with the fancontrol command −
- Prerequisites to Use fancontrol Command
- Syntax of fancontrol Command
- Configuration Variables of fancontrol Command
- Configuring fancontrol on Linux
- Understanding fancontrol Configuration File
Note − The fan control functionality depends upon both hardware and software. If the hardware does not support the fan speed control, this utility may not work. Similarly, if the software of kernel does not support this function you cannot use the fancontrol.
Prerequisites to Use fancontrol Command
To control the fan speed on Linux two tools are required; lm-sensors and fancontrol. These tools are not standard, they need to be installed on Linux. The lm-sensors utility is used to monitor the hardware sensors and the fancontrol controls the fan based on values provided by lm-sensors.
To install the lm-sensors on Linux use the command mentioned below −
sudo apt install lm-sensors #Ubuntu or Debian sudo dnf install lm_sensors #RHEL or CentOS
To verify installation, use the following command −
sensors --version

In some distributions, the fancontrol utility is installed automatically after installing lm-sensors, but in others, it may need to be installed separately.
sudo apt install fancontrol sudo dnf install fancontrol
Syntax of fancontrol Command
The syntax of the Linux fancontrol command is as follows −
fancontrol [configfile]
The [configfile] in the above syntax is used to specify the configuration file that defines how the fan speed should be managed based on system temperature.
Configuration Variables of fancontrol Command
The configuration variables are defined in the configuration file /etc/fancontrol or any custom file. Based on these variables the fan speed is managed −
Variables | Description |
INTERVAL | It defines how often fancontrol checks temperature and adjusts fan speed |
FCTEMPS | It maps the PWM to the temperature sensors and allows fancontrol to check which temperature sensor to use to adjust fan speed |
FCFANS | It records the association between PWM and fan allows fancontrol to monitor fan speed and restart it if stopped unexpectedly |
MINTEMP | It defines the minimum temperature threshold |
MAXTEMP | It defines the maximum temperature threshold |
MINSTART | It defines the minimum temperature at which the fan starts |
MINSTOP | It defines the minimum temperature at which the fan continues spinning |
MINPWM | It defines the PWM value to use when the temperature is below the MINTEMP (It can be acceptable to be set as 0) |
MAXPWM | It defines the PWM value to use when the temperature exceeds MAXTEMP |
Configuring fancontrol On Linux
The configuration is a two-step process: first, detect the installed sensors, and then detect the sensors controlling PWM.
Step 1 − To use the fancontrol a few configurations need to be made. Firstly, detect the sensors using the command given below −
sudo sensors-detect

First, the command will prompt to detect CPU and memory controllers that contain sensors. Type Yes to proceed.
The next prompt will ask for the probe of I2C/SMBus adapters, type Yes −

Caution − Be cautious while using this tool. This may cause damage to your system.
Step 2 − To detect sensors that control the PWM, use the following command −
sudo pwmconfig

This command will stop all the system fans for 5 seconds to detect which fan is controlling which PWM. After successful execution of the pwmconfig command, a fancontrol configuration will be generated in the /etc directory.

The file can be modified. Note that after each modification restart the fancontrol service using systemctl.
sudo systemctl restart fancontrol
To make the changes take effect, run the fancontrol command −
fancontrol

Now, the fancontrol command starts controlling the fan speed based on the provided configuration file (/etc/fancontrol). By default, the fancontrol reads the configuration from /etc/fancontrol, however, it can be changed.
The generated configuration file for fancontrol varies depending on detected sensors. If only one sensor is detected the file will be much simpler. If multiple sensors are controlling the fan the configuration file will be a bit complex.
Understanding fancontrol Configuration File
The configuration file contains the configuration variables following the syntax given below −
VARIABLE=device1=value device2=value
The syntax starts with the variable name, such as INTERVAL, FCTEMPS, or FCFANS, followed by device-value pairs. There can be multiple device-value pairs depending on the hardware.
The device-value pair contains a path of the device and a value after the equal sign. The device path is the location of the specific component typically found in /sys/bus/i2c/devices or /sys/class/hwmon.
A typical /etc/fancontrol configuration file is shown in the following image −

Conclusion
The fancontrol command is used to manually control the fans on Linux. To use it, lm-sensors and fancontrol both utilities need to be installed. The lm-sensor tool detects the sensors and generates the configuration file to control the fan. The fancontrol then uses the configuration file to control the fans. The /etc/fancontrol file can be modified to manually control the fan speed on Linux.
This guide discussed the fancontrol command, its syntax, configuration variables, and configuration in Linux.