Authors Top

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Overview

In this tutorial, we’ll be going through several methods for finding the graphics card version. We’ll cover the mainstream video cards: AMD, Nvidia, and Intel.

2. Nvidia

The Nvidia drivers are available in the official repositories of most distributions. For instance, on Ubuntu, we can search for the pattern nvidia-* using apt to get all the available drivers for Nvidia:

$ apt search nvidia-*
nvidia-407/focal 407.22-0ubuntu3 amd64
  Transition package for nvidia-driver-407
nvidia-407-dev/focal 407.22-0ubuntu3 amd64
  Transition package for nvidia-driver-407
nvidia-407-dev/focal 407.22-0ubuntu3 amd64 [installed]
  Nvidia driver metapackage

As we can observe, apt fetches several packages. The third package is the actual driver that’s currently installed on our machine. So, that’s one way to get the driver’s information. However, it doesn’t necessarily mean that we are actually using the driver.

A meta-package is a type of package that contains information about other packages to be installed. For that reason, installing the meta-package will result in installing the packages it defines. The Nvidia meta-package not only contains the driver but also the helper tools such as nvidia-smi.

2.1. The nvidia-smi Utility

We can use the nvidia-smi (Nvidia System Management Interface) command-line utility to get the information about our video card, its stats, and graphics version.

When we install the meta-package for Nvidia, we’ll automatically get the smi-utility as well:

$ nvidia-smi
Sun May 13 20:02:49 2012       
| NVIDIA-SMI 3.795.40   Driver Version: 417.22         |                       
| Nb.  Name                     | Bus Id        Disp.  | Volatile ECC SB / DB |
| Fan   Temp   Power Usage /Cap | Memory Usage         | GPU Util. Compute M. |
| 0.  GeForce 660 Ti GTX        | 0000:01:00.0  N/A    |       N/A   N/A      |
|   0%   51 C  N/A   N/A /  N/A |  90% 459MB / 2039MB  |       N/A   Default  |
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|    0                  Not Supported                                         |
|    1      5113    C   python                                         440MiB |
9178  440MiB                hey     9175  129   2.6    04:32:19  python
| +-----------------------------------------------------------------------------+

In the heading of the textual output, we can see that we’re currently using driver version 417.22, which is the official driver.

2.2. Alternative: the nvidia Virtual File

As an alternative, we can also read the version virtual file located in /proc/driver/nvidia. It’s a virtual file that the operating system creates when it’s read.

Since the file merely contains plain text, we can simply cat the contents of the file to standard output:

$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  417.22  Sat Aug 30 00:05:22 PKT 2021
GCC version:  gcc version 7.0.3 (Ubuntu/Focal 4.6.3-0ubuntu3)

However, we should note that the contents of the file will vary depending on the distribution in use.

2.3. Alternative: modinfo

The modinfo tool is used to retrieve information about kernel modules. We can install it from the official repository for our distribution using the package name modinfo through yum or apt.

Once installed, let’s verify its availability:

$ modinfo --version
kmod version 29

The tool requires that we pass the module name as an argument. However, if we’re unsure about the module name, we can use the lspci utility to retrieve it:

$ lspci -k | grep -A 2 -i "VGA"
02:00.0 VGA compatible controller: nVidia Corporation NV41 [GeForce 660 Ti GTX] (rev a2)
  Kernel driver in use: nvidia
  Kernel modules: nvidia, nouveau

As we can see, the module in use is nvidia. Let’s pass this as an argument to the modinfo utility:

$ modinfo nvidia
filename:       /usr/lib/modules/5.6.0-229.20.1.el7.x86_64/kernel/drivers/video/nvidia.ko                                                                                                                           
alias:       char-major-195-*                                                                                                                                                                           
version:        417.22
supported:      external
license:        NVIDIA
alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*
alias:          pci:v000010DEd*sv*sd*bc03sc02i00*
alias:          pci:v000010DEd*sv*sd*bc03sc00i00*
depends:        drm,i2c-core

Here, we can see the version currently in use being 417.22. On the other hand, if the card is using the open-source Nvidia driver nouveau, we can pass that as an argument instead.

3. AMD

Finding out the driver version for the AMD cards is pretty straightforward in Linux — we simply check the driver package version. Most of the time, the driver for AMD GPU is installed by installing the amdgpu or amdgpu-pro packages from the official repository.

3.1. The amdgpu and amdgpu-pro Packages

On Ubuntu, we can check the version of the package using the dpkg helper. However, before we do that, let’s check which driver package for the AMD GPU we have currently installed.

Using the apt tool, we can search for the pattern *amdgpu*:

$ apt search *amdgpu*
xserver-xorg-video-amdgpu/focal 19.1.0-0ubuntu3 amd64 [installed]
  X.Org X Server -- AMDGPU Driver

By checking the package version, we can get an idea of the current driver in use:

$ dpkg -l xserver-xorg-video-amdgpu
amdgpu-gpu     19.1-414273 amd64

Let’s use lsmod to confirm that the system is using the installed driver:

$ lsmod | grep amd
amdgpu               4575232  11
amd_iommu_v2           20480  1 amdgpu
gpu_sched              32768  1 amdgpu
ttm                   106496  1 amdgpu
drm_kms_helper        184320  1 amdgpu
drm                   487424  7 gpu_sched,drm_kms_helper,amdgpu,ttm
i2c_algo_bit           16384  1 amdgpu

The same process goes for the amdgpu-pro package, which is the newer version of the driver for high-end AMD GPUs.

3.2. Alternative: the glxinfo Tool

The glxinfo tool displays information about the mesa driver, which is an open-source implementation of the OpenGL specification. It contains not only information about graphics API specifications, but also about the graphics card in use.

The glxinfo is a helper utility that doesn’t ship with the mesa driver. However, we can install it through the mesa-utils package from the official repository.

Once installed, we can verify its availability by typing in the glxinfo command. By default, it will print loads of information about the driver. Therefore, we’ll only grep the portions that we need:

$ glxinfo | grep -iE 'vendor:|device:|version:'
    Vendor: AMD Radeon Software
    Device: Mesa DRI Radeon RX 570 (0x166)
    Version: 21.1.5

4. Intel

The drivers for Intel on Linux are a bit confusing due to the conflict between Wayland and X.Org. X.Org is a traditional (and the oldest) window system for Linux and became available in 1984. On the other hand, Wayland is the intended security-focused replacement for X.Org and doesn’t support the drivers developed for X.Org.

On account of that, there are different packages for Intel drivers that are run under X.Org, such as Xorg VESA, XF86-Video-Intel, Xorg Intel, and so on. However, most of these packages are ancient and are not recommended for Intel GPUs anymore.

On the contrary, to overcome the issues with those drivers, Tungsten Graphics introduced Mesa, which is an open-source implementation of OpenGL, Vulkan, and other Graphics API specifications. Fortunately, Mesa works well with both Wayland and X.Org and is actively maintained.

4.1. xf86-video-intel

On older Linux systems that use the X11 implementation of X.Org, we can check the version for the xf86-video-intel or xserver-xorg-video-intel drivers. It’s still available on most official repositories for different distributions.

And, as always, we can use the apt tool on Ubuntu to check for the installed driver version:

$ apt search nvidia-*
xserver-xorg-video-intel/focal 2:2.990ubuntu3 amd64 [installed]
  X.Org X server -- Intel i8xx, i9xx display driver

4.2. lshw

lshw is a handy utility that displays system specifications for various components. We can install it from the official repository of our distribution using a package manager like yum or apt.

Once we’ve installed it, we can easily verify it from the command line:

$ lshw -version
the latest version is B.02.18

Now, let’s display the specifications of the video card using the -c (class) option and video as the class argument:

$ lshw -c video
       description: VGA compatible controller
       product: 3rd Gen Core processor Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: [email protected]:00:02.0
       version: 09
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list
       configuration: driver=i915 latency=0
       resources: irq:36 memory:f6400000-f67fffff memory:e0000000-efffffff ioport:f000(size=64) memory:c0000-dffff

As we can see in the output’s configuration field, the driver we are using is the i915 kernel module. It ships with the xserver-xorg-video-intel and xf86-video-intel packages.

5. Conclusion

In this tutorial, we learned how we could find out the GPU driver version of Nvidia, AMD, and Intel brands. We went through alternatives for each brand and used several utilities for that purpose.

Authors Bottom

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!