How can I change the nvidia GPU fan speed?

In the terminal run:

sudo nvidia-xconfig
sudo nvidia-xconfig --cool-bits=4

restart your computer and search for NVIDIA X Server Settings in the Dash. There should be an option to change fan speed under Thermal Settings.


Be careful about the highest voted answer. I have two 2080ti GPUs and running that command made my computer unable to boot.

Finally, I found an answer from here. Following that:

  1. Create a file named /etc/X11/xorg.conf.d/11-nvidia-coolbits.conf and write the following in it:

    Section "OutputClass"
        Identifier "nvidia"
        MatchDriver "nvidia-drm"
        Driver "nvidia"
        Option "Coolbits" "4"
    EndSection
    
  2. Log out and log back in.

  3. Run nvidia-settings. In the windows that opens you can now find the fan speed control options. Only the fan speed of one GPU can be controlled though.


Try sudo apt-get install nvclock


To control Nvidia GPU fan speed via Terminal on Linux Mint 20 with a 1070 Ti:

sudo nvidia-xconfig --cool-bits=4

to tell nvidia-xconfig to allow the fan to be controlled in the command line. You may need to reboot here.

nvidia-smi

Gives information about the GPU(s) and their numbers. Importantly I note that my 1070 Ti is GPU 0.

nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=55"

For a much more detailed overview of this feature including multiple GPU fans, check out this thorough documentation Nvidia Overclocking and Cooling

For a somewhat rambling and wayward thread which lead me to the above link, check out Set Fanspeed in Linux from Terminal

==================END OF ANSWER==================

And as an extra tidbit not asked for in this question, you can also adjust the power output of your Nvidia GPU with:

sudo nvidia-smi -i 0 -pl 90

Where the 0 is my GPU number, and the 90 is the maximum power in watts. If you set this too low, you will get an error. In my limited experience, setting it too high had no effect. I found I can get 95%+ performance for ~75% energy cost by setting the power level to 100 in the above command in my mining rig, but I imagine other power conscious users would appreciate this too.