If you’re intending to run AAA games on Linux, you’ll need to ensure you’re using the latest graphics drivers. But does Nvidia produce a driver for Linux?
Thankfully, yes it does. But how do you install the latest drivers on Ubuntu? Whether you prefer to use the desktop environment or command line, installing and updating the Nvidia graphics driver on Ubuntu is straightforward.
Check You’re Using an Nvidia GPU
You can install graphics card drivers in the terminal or using the desktop environment (or GUI, for graphical user interface). However, to check the specifics of your current graphics card, it’s best to use the terminal.
Open the terminal from the menu or use Ctrl + Alt + T.
sudo apt install hwinfo
Once installed, use hwinfo to check your graphics card using the –gfxcard option.
sudo hwinfo --gfxcard --short
If you have identified an Nvidia GPU, use the lshw (list hardware) command to reveal further details of the card.
sudo lshw -c display | grep NVIDIA
Alternatively, for more specific details use lspci (list PCI) and grep
sudo lspci | grep -i --color 'vga|3d|2d'
For the full set of relevant details concerning your Ubuntu system’s Nvidia card use
sudo inxi -Gx
With this information to hand, you have everything you need to install the correct Nvidia driver in Ubuntu.
Update Your System
Before proceeding, however, you should update your Ubuntu system. The steps in this guide are intended for Ubuntu 20.04 LTS (Focal Fossa). At the time of writing this is the current LTS release, so ensure you’re using this version or later.
Note that with Ubuntu 19.10 and later, Nvidia’s proprietary drivers are included in the installation media. As such, you may already have the Nvidia drivers installed. Otherwise, upgrade to the latest Ubuntu version.
Update and upgrade Ubuntu with
sudo apt update && sudo apt upgrade -y
Alternatively, open the Software Update Manager and wait for it to check for updates. Install any system updates it highlights.
Install Nvidia Drivers on Ubuntu on the Desktop GUI
Using the Ubuntu Software Updater, you can find and install the right driver for your Nvidia graphics card.
- Open the Ubuntu app menu and scroll to Software Updater
- Alternatively, open the menu and type “software updater” to search for the tool
- Select Software Updater to open, then wait while it checks for updates
- Once done (you should have updated before starting) click Settings & Livepatch
- Click the Additional Drivers tab
- Select an Nvidia driver metapackage that is appended with (proprietary, tested)
- Click Apply Changes and wait while the new driver is installed
The X.Org X server is typically the default option. It is also open source, so you may prefer this from a philosophical point of view. However, if you want the best gaming performance, the Nvidia driver is required.
You should notice a list of drivers, like the one illustrated above. You can use any of these, but it is safer to start with a version that has been tested. After restarting Ubuntu, the Nvidia driver will be in use.
How to Install Nvidia Drivers on Ubuntu in the Terminal
If you prefer to install an Nvidia graphics driver on Ubuntu from the command line, open the terminal and enter
sudo ubuntu-drivers devices
This will list all the currently available drivers for your graphics card. You’ll notice the preinstalled option is listed as “distro free builtin.”
To choose the driver listed as “recommended”, use
sudo ubuntu-drivers autoinstall
You can also install a specific, named driver with
sudo apt install nvidia-driver-[version_number]
For instance, to install nvidia-driver-450, use
sudo apt install nvidia-driver-450
Confirm the command and follow and further instructions displayed in the terminal. When you’re done, restart Ubuntu.
sudo reboot
In some cases, you may need to ensure that the Nvidia graphics card is active. This could be preferable to leaving it to the OS to decide to use the Intel graphics. To check which video card is selected, use
prime-select query
To select the Intel card, use
sudo prime-select intel
Force the Nvidia card with
sudo prime-select nvidia
You may need to reboot for the alternate graphics card choice to take effect. Note that on laptops, the Nvidia card will be more demanding on your device battery than the Intel option.
Configure and Manage the Nvidia Drivers on Ubuntu
To quickly find out which GPU is active, what driver is installed, and what resources are in use, enter
nvidia-smi
This should give you all the information that you need and is a useful reference for configuring graphics in-game. For more granular management, open the settings screen with
sudo nvidia-settings
This screen provides far more data than the nvidia-smi tool. Here, you’ll find X server and OpenGL settings; of particular interest will be the Thermal Settings screen for checking the GPU temperature.
You can also select enhanced performance modes in the PowerMizer screen, create and manage Application Profiles, and switch PRIME Profiles.
This last option is like the prime-select command, but gives you three options:
- NVIDIA (Performance Mode)
- NVIDIA On-Demand
- Intel (Power Saving Mode)
For the best graphics performance, you’ll naturally select the Performance Mode.
How to Update Nvidia Graphics Card Drivers in Ubuntu
Updating your Nvidia graphics card driver should happen whenever an update is available. Since Ubuntu 19.10, Nvidia drivers are included in the LTS repository.
Updating the drivers, therefore, is as easy as updating any other software in Ubuntu. Either run and update and upgrade in the terminal, or use the Software Updater on the desktop.
Uninstalling Nvidia Drivers in Ubuntu
You may prefer to remove the Nvidia drivers. This might happen if the driver is not performing to your expectations. Alternatively, you might have decided to abandon Nvidia and use an AMD card.
Uninstall Nvidia GPU Drivers on the Desktop
Once again open the Software Updater. From here:
- Wait for the update check to complete
- Click Settings & Livepatch
- Click Additional drivers
- Select the Nouveau display driver option
- Click Apply Changes
A short wait is required; once the change has been made you should see a message informing you that “No proprietary drivers are in use.”
Uninstall Nvidia Drivers in the Terminal
To uninstall the Nvidia graphic driver in the terminal:
sudo apt purge nvidia-*
sudo apt autoremove
Reboot your system before proceeding. By default, the system will switch to the Nouveau open source driver.
Gaming on Linux: Use the Best Drivers For Your Distro
With the Nvidia drivers installed on your Ubuntu system, you should be able to squeeze better graphics performance from your GPU. This is a massive advantage for Linux gaming, but Ubuntu might not be the best distro for gaming. If you’re keen to make the most of gaming on Linux, be sure to use the best Linux gaming distro.