To install the last Nvidia drivers, you have to add the repository (“PPA”) to your package sources, update the sources and list the available drivers:
First check whether your distro already uses the latest Nvidia drivers. That seems to be the case for the latest Ubuntu distros / flavours. You can do so by issuing the command
sudo apt list --installed | grep nvidia-driver
While I wrote this documentation the current version was 5.70
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo ubuntu-drivers devices
You can start the installation with:
sudo apt install nvidia-driver-570
Should you need to uninstall the drivers, you can do so with the command:
sudo apt purge nvidia-*
sudo apt autoremove
To rempove the repo, use the command:
sudo add-apt-repository --remove ppa:graphics-drivers/ppa