What is the Terminal command to purge all current Nvidia drivers and install Nvidia binary driver - version 331.104?

  • Do you want to install the Linux Display Driver NVIDIA Certified Version 331.1040 from the official NVIDIA Driver Downloads website? Before you install the graphics driver please run ubuntu-drivers devices from the terminal in order to find out which NVIDIA proprietary graphics driver is recommended for your system.
    – karel
    Nov 7, 2014 at 2:05
  • Thanks for the tip... I checked and it listed three drivers... nvidia-340, nvidia-331, and nouveau... I followed the below instructions to install nouveau: askubuntu.com/questions/206283/…
    – Push
    Nov 7, 2014 at 2:23
  • 1
    Seems to be working
    – Push
    Nov 7, 2014 at 2:23
  • You have nvidia-340 listed in the output of ubuntu-drivers devices means that a graphics driver that you downloaded from the official NVIDIA website was already installed. If you have uninstalled it and run the command ubuntu-drivers devices again it will tell you the recommended graphics driver from only the Ubuntu repositories, which is usually a better graphics driver than a graphics driver which you download from the official NVIDIA website.
    – karel
    Nov 7, 2014 at 2:42
  • 1
    I purged all Nvidia drivers by running command sudo apt-get remove --purge nvidia-* Then ran the command you recommended and tried all three drivers. Nvidia-340 works the best, but video playback still has some unavoidable glitchiness to it.
    – Push
    Nov 7, 2014 at 2:44

1 Answer 1


To find out what nvidia driver is installed, run the following command:

dpkg -l | grep nvidia

To purge the driver (nvidia-340 for example) run the following command:

sudo apt-get purge nvidia-340

To install version 331.89 run the following command or skip this command and install the ppa for version 331.104:

sudo apt-get install nvidia-331

Save any unsaved files before you begin.

To install version 331.104 go to this website http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/331.104/NVIDIA-Linux-x86_64-331.104.run&lang=us&type=geforcem

Click to agree to the terms and conditions and download the file to your home folder (~/). Then, press Ctrl + Alt + F2 login with your username and password and execute the following command:

sudo service lightdm stop

If you use GDM, type this command instead:

sudo service gdm stop

Then run the following commands:

sudo apt-get update
sudo apt-get install dkms gcc build-essential linux-headers-generic linux-headers-`uname -r` linux-source
sudo chmod +x NVIDIA-Linux-x86_64-331.104.run
sudo ./NVIDIA-Linux-x86_64-331.104.run

Follow the instructions and reboot when you are done.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .