A lightweight Bash script to manually control the fan speed of Lenovo ThinkPads via the thinkpad_acpi kernel module interface. It provides an intuitive, man-page style CLI wrapper around /proc/acpi/ibm/fan.
- Automatic Mode: Instantly switch back to internal BIOS/firmware fan curves.
- Full-Speed Mode: Disengage the fan restrictions to run at absolute physical maximum speed (useful to prevent thermal throttling during heavy compilation or rendering tasks).
- Manual Levels: Set fixed fan steps from level 1 (quietest) to level 7 (maximum regular speed).
- Status Dashboard: Instantly clears the screen and prints the current RPM, level, and operational mode.
Before using this script, you must ensure that the thinkpad_acpi kernel module is configured to allow manual fan control. By default, the Linux kernel restricts user-space writes to the fan interface.
Create or edit a configuration file inside /etc/modprobe.d/ (e.g., thinkpad_acpi.conf) and add the following option:
options thinkpad_acpi fan_control=1Or run this single command to apply it instantly:
echo "options thinkpad_acpi fan_control=1" | sudo tee /etc/modprobe.d/thinkpad_acpi.conf && sudo modprobe -r thinkpad_acpi && sudo modprobe thinkpad_acpi Ensure that the ACPI fan interface is visible and writable:
ls -l /proc/acpi/ibm/fan To install fan system-wide so it can be executed from anywhere:
-
Save the script content to a file named fan.
-
Make it executable:
chmod +x fan
-
Move it to a directory in your system $PATH (e.g., /usr/local/bin/):
sudo mv fan /usr/local/bin/
The script requires root privileges (sudo) to write directly to the hardware interface.
SYNTAX
fan [OPTION]
OPTIONS
-a, --auto
Resets the fan to automatic mode (BIOS control). Recommended after intensive tasks.
-f, --full
Activates full-speed mode (disengaged). The fan spins at its maximum physical speed.
Prevents thermal throttling during demanding CPU tasks.
-s, --status
Displays the current fan status (mode, current speed, level).
-l, --level <1-7>
Sets a fixed fan level from 1 (lowest setting) to 7 (highest regular setting).
-h, --help
Displays the built-in man-page.
### Examples
- Check the current RPM and speed level:
Bash
fan -s
- Set the fan to full throttle for heavy workloads:
Bash
fan -f
- Return control to the system BIOS:
Bash
fan -a
- Set a precise speed level (e.g., Level 4):
Bash
fan -l 4
This occurs if you are not running the script on a supported IBM/Lenovo ThinkPad, or if the thinkpad_acpi kernel module is missing entirely from your active kernel configuration.
The script internal commands utilize sudo tee to modify /proc/acpi/ibm/fan. Ensure your current user has valid sudo permissions, or run the utility directly as root.