Need to identify the Graphics Processing Unit (GPU) in a Linux computer? Here’s how you can identify the graphics card from the command line and in GNOME.
The First Step
You’ve probably been there. You’re drafted to provide support for a nontechie relative or work colleague, and something tells you this isn’t going to be painless. Still, you pitch in! You quickly determine the issue is likely a display driver issue. Hey, this might not be so bad after all! But then your short-lived flicker of hope is snuffed when you ask, “What kind of graphics card do you have?”
The deer-in-headlights expression you receive in response speaks volumes. To support something, you need to know what it is. So how do you identify the graphics card in a Linux computer?
Let’s assume the worst-case scenario and say the drivers for the graphics card were never installed, so you can’t even look at those to get a clue. It doesn’t matter! You can solve this conundrum either from the command line or through the graphical user interface (GUI).
lspci and the PCI ID Database
The Peripheral Component Interconnect (PCI) standard is a common protocol you can use to talk to internal peripherals, such as graphics cards. The PCI ID Repository maintains a database of all known IDs for PCI devices. This means if you know some information about the device, you can look it up.
You can use the
lspci command to list the PCI devices installed on a Linux computer, as well as some information about them.
Wouldn’t it be great if we could tie the PCI database and the
lspci command together? Well, actually, that’s exactly what happens when you run the
lspci command. It checks a local copy of the PCI database to identify the PCI devices it detects. Before we start, it’s wise to update the local copy of the PCI database.
update-pciids command to do just that:
The latest database version is retrieved for us, and we can now use the
lspci command. There’ll be a lot of output, so we’ll pipe it into
-v (verbose) option tells
lscpi to give us as much information as it can. We’ll use
sudo to ensure the information is as detailed as possible.
We type our command as follows:
sudo lspci -v | less
The results appear in
less. If you press the forward-slash (
/), you activate the
less search function.
Type “VGA” in all caps and press Enter.
less searches for the string, “VGA,” and it shows you the first matches it finds. From that point, you can scroll or page forward to see how many graphics cards
For this article, we conducted our research on a variety of Linux distributions running in VirtualBox virtual machines. Virtual machines, of course, have virtual graphics cards.
So you can see an example of real-world results, here’s the output from the host (physical) computer:
26:00.0 VGA compatible controller: NVIDIA Corporation GP108 [GeForce GT 1030] (rev a1) (prog-if 00 [VGA controller]) Subsystem: Gigabyte Technology Co., Ltd GP108 [GeForce GT 1030] Flags: bus master, fast devsel, latency 0, IRQ 97 Memory at f6000000 (32-bit, non-prefetchable) [size=16M] Memory at e0000000 (64-bit, prefetchable) [size=256M] Memory at f0000000 (64-bit, prefetchable) [size=32M] I/O ports at e000 [size=128] Expansion ROM at 000c0000 [disabled] [size=128K] Capabilities:  Power Management version 3 Capabilities:  MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities:  Express Legacy Endpoint, MSI 00 Capabilities:  Virtual Channel Capabilities:  Latency Tolerance Reporting Capabilities:  Power Budgeting <?> Capabilities:  Advanced Error Reporting Capabilities:  Vendor Specific Information: ID=0001 Rev=1 Len=024 <?> Capabilities:  Secondary PCI Express <?> Kernel driver in use: nouveau Kernel modules: nouveau
It gave us a lot of good information right away!
The card is an NVIDIA Corporation GP108 [GeForce GT 1030], and, after a few seconds with a search engine, we found the NVIDIA tech page for that device. The “[VGA controller]” text at the end of the first line indicates this is the “operational” graphics card. That’s useful info when more than one card is installed on a computer.
The lshw Command
You can also use the
lshw command to list the hardware installed on a Linux computer. It reports a variety of types, too—not just PCI hardware.
To tell it to report on the graphics cards it finds, we’ll use the
-C (class) option and pass the “display” modifier. The
-numeric option forces
lshw to provide the numeric IDs of the devices, as well as their names.
Type the following:
sudo lshw -numeric -C display
Here’s what that command found on the physical computer:
*-display description: VGA compatible controller product: GP108 [GeForce GT 1030] [10DE:1D01] vendor: NVIDIA Corporation [10DE] physical id: 0 bus info: pci@0000:26:00.0 version: a1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress vga_controller bus_master cap_list rom configuration: driver=nouveau latency=0 resources: irq:97 memory:f6000000-f6ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff
Encouragingly, both found the same card!
The [10DE:1D01] identifiers represent the manufacturer (10DE) and the model (1D01). To find the make and model immediately, you could type “graphics card 10de:1d01” into a search engine.
The glxinfo Command
glxinfo command is yet another method you can use. It gives you information from the OpenGL extension for the X Windows system. You can then search some of that information to find out what kind of graphics card is installed on a machine.
glxinfo command is already present on Manjaro and Fedora, but you have to install it on Ubuntu. To do so, type the following command:
sudo apt-get install mesa-utils
To pipe the output from
less, and use the
-B (print IDs) option, type the following:
glxinfo -B | less
The graphics card is described in the “Device” line.
This is the output from the physical computer:
name of display: :1 display: :1 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: nouveau (0x10de) Device: NV138 (0x1d01) Version: 19.3.2 Accelerated: yes Video memory: 1987MB Unified memory: no Preferred profile: core (0x1) Max core profile version: 4.3 Max compat profile version: 4.3 Max GLES1 profile version: 1.1 Max GLES profile version: 3.2 OpenGL vendor string: nouveau OpenGL renderer string: NV138 OpenGL core profile version string: 4.3 (Core Profile) Mesa 19.3.2 OpenGL core profile shading language version string: 4.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL version string: 4.3 (Compatibility Profile) Mesa 19.3.2 OpenGL shading language version string: 4.30 OpenGL context flags: (none) OpenGL profile mask: compatibility profile OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.3.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
When you type “NV138” into a search engine, the NVIDIA graphics card is identified immediately.
Using the GUI to Identify the Graphics Card
If the computer is a CLI-only server, you have to use one of the techniques we covered above. If it has a (working) GUI, though, there’s likely a graphical way you can identify the graphics card. In fact, that option is probably somewhere in your Linux desktop settings tools.
On a GNOME desktop, open the “Settings” dialog, and then click “Details” in the sidebar. In the “About” panel, look for a “Graphics” entry. This tells you what kind of graphics card is in the computer, or, more specifically, the graphics card that’s currently in use. Your machine might have more than one GPU.
In the GNOME Settings “About” tab from a physical host, we get the same “NV138” card ID we saw earlier. Again, we can plug that info into a search engine to find the card type.
Graphics Cards on Laptops
Many laptops have two graphics cards: one from the manufacturer of the central processing unit (CPU), and one from a mainstream GPU provider.
Let’s type the same
lspci command from earlier, but this time, we’ll run it on a laptop:
sudo lspci -v | less
As expected, we get a description of the graphics cards in the machine:
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) (prog-if 00 [VGA controller]) Subsystem: ASUSTeK Computer Inc. 3rd Gen Core processor Graphics Controller Flags: bus master, fast devsel, latency 0, IRQ 33 Memory at f7400000 (64-bit, non-prefetchable) [size=4M] Memory at d0000000 (64-bit, prefetchable) [size=256M] I/O ports at f000 [size=64] [virtual] Expansion ROM at 000c0000 [disabled] [size=128K] Capabilities:  MSI: Enable+ Count=1/1 Maskable- 64bit- Capabilities: [d0] Power Management version 2 Capabilities: [a4] PCI Advanced Features Kernel driver in use: i915 Kernel modules: i915 01:00.0 VGA compatible controller: NVIDIA Corporation GF119M [GeForce 610M] (rev a1) (prog-if 00 [VGA controller]) Subsystem: ASUSTeK Computer Inc. GF119M [GeForce 610M] Flags: bus master, fast devsel, latency 0, IRQ 34 Memory at f6000000 (32-bit, non-prefetchable) [size=16M] Memory at e0000000 (64-bit, prefetchable) [size=128M] Memory at e8000000 (64-bit, prefetchable) [size=32M] I/O ports at e000 [size=128] Expansion ROM at f7000000 [disabled] [size=512K] Capabilities:  Power Management version 3 Capabilities:  MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities:  Express Endpoint, MSI 00 Capabilities: [b4] Vendor Specific Information: Len=14 <?> Capabilities:  Virtual Channel Capabilities:  Power Budgeting <?> Capabilities:  Vendor Specific Information: ID=0001 Rev=1 Len=024 <?> Kernel driver in use: nouveau Kernel modules: nouveau
This laptop has both an Intel Core GPU and an NVIDIA GeForce 610M. However, both cards have the “[VGA controller]” string, which usually indicates which GPU is in use.
They can’t both be in use, so try to get the card from the mainstream GPU provider working first. That’s the one the laptop manufacturer considers the default and includes in the hardware specifications for the machine.
One of the techniques we’ve covered here is sure to work for you! After you know which type of graphics card a computer or laptop has, you can select the appropriate graphics driver.