Why Do You Need to Know What GPU You Have?
After booting I've got a black screen only
Why Do You Need to Know What GPU You Have?
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).
Â
Knowing the GPU in a Linux computer is important for troubleshooting display driver issues and providing support to others.
The lspci command and PCI ID Database can be used to identify the graphics card from the command line in Linux.
The lshw command and glxinfo command are alternative methods to identify the graphics card, providing different types of information.
Â
Use the lshw Command to Find Your GPU
Â
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
Â
Â
Use the lspci and the PCI ID Database to Check Your GPU
Â
Use the lspci and the PCI ID Database to Check Your GPU
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 (package: pciutils) command to do just that:
Â
sudo update-pciids
Â
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:
Â
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 lspci
found.
Â
Â
The card is an NVIDIA Corporation RTX 3080 [GeForce GTX 3080], 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.
Â
Â
Â
Â
Â
Â