How to change proprietary video driver using the command line?

As per this Ubuntu Community Help Wiki Page, Ubuntu 14.04+ is different:

Ubuntu 14.04 and up

The jockey-text command was removed with the release of Ubuntu 14.04. You can now use ubuntu-drivers to get the list of packages for each driver, and then install the packages using apt-get. For example:

sudo ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==

vendor   : NVIDIA Corporation
modalias : pci:v000010DEd00000DDAsv000017AAsd000021D1bc03sc00i00
model    : GF106GLM [Quadro 2000M]
driver   : xserver-xorg-video-nouveau - distro free builtin
driver   : nvidia-304-updates - distro non-free
driver   : nvidia-304 - distro non-free
driver   : nvidia-331 - distro non-free recommended
driver   : nvidia-331-updates - distro non-free

sudo apt-get install nvidia-331

Ubuntu 12.04 (same as mikewhatever's answer)

If you need to change drivers without the use of the X GUI, perhaps because those drivers are not installed, you can with the jockey-text command. For example:

jockey-text --help
jockey-text -l
jockey-text -e xorg:nvidia_current

I had the same problem using 304/319 drivers from repositories, Nvidia has proprietary drivers on their website, installed from there they actually work quite well, I used this manual to remove remaining drivers and install the correct one directly from Nvidia.

http://www.beginninglinux.com/home/graphics-drivers/install-nvidia-custom-driver-on-ubuntu-12-04

Make sure you pay attention to everything, especially make sure that in /etc/default/grub line GRUB_CMDLINE_LINUX_DEFAULT contains nomodeset, otherwise Nvidia driver does not work.

Also if proprietary drivers do not work and you are stuck in command line, you may always uninstall Nvidia drivers and install the default nouveau driver.

sudo apt-get autoremove --purge nvidia-*
sudo service lightdm stop
sudo apt-get install xserver-xorg-video-nouveau

Ubuntu 12.04 (for later versions, see other answers)

You can use jockey-text to disable and enable Nvidia drivers in Ubuntu.

For example:

  • Run jockey-text --list to get the list of available options.

  • Run sudo jockey-text -d xorg:nvidia_304 to remove the 304 driver.

  • Run sudo jockey-text -e xorg:nvidia_304 to enable the same driver.

  • Run jockey-text --help to see the help manual.