In linux, the fan speed is not controlled by default and the card itself auto adjusts the fan speed; in this tutorial I’m going to teach a way to Automatically and Manually control the fan speed of an Nvidia graphics card on Linux with proprietary drivers at Boot and Reboot.
1.Controlling fan speed Manually:
Nvidia doesn’t enable this feature by default and it’s on the user to enable it using the command line.
Back in the days, it used to be
nvclock but the support was dropped in 2010. Here’s a short guide on how to control the fan using Nvidia X Server Settings.
The ‘Nvidia X server Settings’ application is installed along with the proprietary driver.The following command needs to be executed in Terminal to enable fan control in Nvidia X server Settings:
sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration
After this commands, a reboot or a logout is required to apply the changed to
nvidia-xconfig. After the reboot/login, open the nvidia x server settings application and first go to the ‘PowerMizer section and set the ‘Perferred mode’ to ‘Prefer Maximum Performance’ So your graphics card won’t clock down.
After this, go to the ‘Thermal Settings’ section and therefore control the fan speed by your own hands:
1.Controlling fan speed Automatically at boot:
Now this was only controlling it manually through the
nvidia-settings software. these changes will not apply at boot and do not auto adjust.
I found a little program on github to control the fan speed with a fan curve!:
Download the program from github with this command:
git clone https://github.com/nan0s7/nfancurve
cd into the directory which it downloaded in:
now we see a few files:
config LICENCE README.md temp.sh update.sh USAGE.md VERSION.txt
The only file which needs to be modified is the config file; inside this file, fan curve and some other options can be set; here are some of the important ones:
min_t="25" # This is the temperature which any number below it will cause the fan speed to drop to 0 fcurve=( "30" "37" "45" "55" "57" ) # Fan Speeds tcurve=( "45" "55" "65" "75" "85" ) # Temperatures
Now in this example; the fan speed would be 30% at the temperature of 45 celcius, 37% at 55 celcius and so on. after changing the values to your preference, save the changes.
The fan speed is controlled by file temp.sh. First make the script, executable with the command below:
chmod +x ./temp.sh
Then run the script:
If everything is working fine, the fan speed will adjust and you’ll see the changes on your terminal. Now stop the script by using
CTRL+C. To suppress its output and run it in the background; do as follows:
# Run it in the background ./temp.sh &> /dev/null & # Check the jobs: jobs -l #Find temp.sh and its count(i.e.  or  or ...) then disown it(I assumed it was ): disown -h %1
Now the script will run in the background forever until you log out or reboot or kill the job with
Now if I want the script to run at reboot without me ever bothered; I can whether add it to the startup applications manager of my DE or add it to
If you want to add it to your Desktop Environment’s startup application manager; just simply search it and add the
temp.sh script wherever you saved it. Every Desktop Environment is different and the process is super easy; so I’m not including it in this tutorial. You can search it for your own Desktop Environment with google!
To add this script to
rc.local, do as follows:
open the file with a text editor as root:
sudo gedit /etc/rc.local
then add the following line before the
exit 0 line:
# Change the /home/user directory to where the script is! bash /home/user/nfancurve/temp.sh
save the file and wallah! Now the script will run and auto adjust the fan speed by the curve set without ever bothering you.