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.
Type the 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 less. The -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:
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 lspci found.
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:
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:
Here’s what that command found on the physical computer:
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
The 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.
The glxinfo command is already present on Manjaro and Fedora, but you have to install it on Ubuntu. To do so, type the following command:
To pipe the output from glxinfo through less, and use the -B (print IDs) option, type the following:
The graphics card is described in the “Device” line.
This is the output from the physical computer:
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:
As expected, we get a description of the graphics cards in the machine:
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.