Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Linux List GPUs: Commands & Tools

· 4 min read · Home Tech

In this article
  1. Why Listing GPUs on Linux Is Different
  2. Basic Commands: lspci and lsusb
  3. NVIDIA-Specific Tools
  4. AMD and Intel: Using /sys and glxinfo
  5. Using lshw and hwinfo
  6. Common Problems and Misconceptions
  7. How to Choose the Right Command
  8. Frequently Asked Questions

The quickest way to list GPUs on Linux is to run lspci | grep -i vga or lspci | grep -i 3d in a terminal. For detailed information including driver and memory, use nvidia-smi (NVIDIA) or glxinfo -B (Mesa/OpenGL).

Why Listing GPUs on Linux Is Different

Unlike Windows, Linux doesn't have a single built-in "Device Manager" GUI. Instead, you have multiple command-line tools that query different layers of the hardware stack. The PCI bus is the fundamental level where the kernel sees all hardware, and lspci reads that directly. For graphics-specific details, you need tools that talk to the DRM (Direct Rendering Manager) subsystem or the vendor's driver.

Basic Commands: lspci and lsusb

The most universal command is lspci. It lists all PCI devices, and you can filter for graphics:

  • lspci | grep -i vga – shows VGA-compatible controllers (most GPUs)
  • lspci | grep -i 3d – shows 3D controllers (often NVIDIA or AMD GPUs)
  • lspci -v -s 01:00.0 – shows verbose info for a specific PCI address

For external GPUs connected via USB (e.g., Thunderbolt enclosures), lsusb may show them, but the PCI address is still the primary way.

NVIDIA-Specific Tools

If you have an NVIDIA GPU with the proprietary driver installed, nvidia-smi is the go-to command. It shows:

  • GPU model, driver version, and CUDA version
  • Memory usage and temperature
  • Running processes using the GPU

Example output snippet:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.78.01    Driver Version: 525.78.01    CUDA Version: 12.0      |
|-------------------------------+----------------------+----------------------+|
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 3080     Off  | 00000000:01:00.0  On |                  N/A |
|  0%   45C    P8     8W / 320W |    512MiB / 10240MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

If nvidia-smi is not found, the driver is likely not installed or not loaded.

AMD and Intel: Using /sys and glxinfo

For AMD and Intel GPUs, the kernel exposes information via /sys/class/drm. The command ls /sys/class/drm shows entries like card0, card1, and renderD128. To see the device name, run:

cat /sys/class/drm/card0/device/vendor
cat /sys/class/drm/card0/device/device

But a more user-friendly approach is to install mesa-utils and run glxinfo -B. It prints the OpenGL renderer string, which includes the GPU model. Example:

OpenGL renderer string: AMD Radeon RX 6800 XT (navi21, LLVM 15.0.7, DRM 3.47)

For Intel integrated graphics, you might see Intel(R) UHD Graphics 630.

Using lshw and hwinfo

If you want a more structured output, lshw can list all hardware including GPUs:

sudo lshw -C display

This shows the product name, vendor, and driver in use. Similarly, hwinfo --gfxcard (from the hwinfo package) provides detailed info.

Common Problems and Misconceptions

Problem: lspci shows a GPU but the system doesn't use it. This often happens with Optimus laptops (NVIDIA + Intel). The Intel GPU is the primary, and the NVIDIA GPU is only used when requested. Use prime-select or nvidia-smi to check.

Misconception: lspci always shows the actual GPU model. It shows the PCI device ID, which may be generic (e.g., "VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate]"). Sometimes the name is vague; use lspci -vnn to get the full ID and look it up.

Problem: No output for AMD/Intel GPUs. Some older tools rely on X11 or Wayland; if you're on a headless server, glxinfo may fail. Use lspci or ls /sys/class/drm instead.

How to Choose the Right Command

Your choice depends on what you need:

  • Quick check of GPU model: lspci | grep -i vga
  • NVIDIA driver status and utilization: nvidia-smi
  • OpenGL renderer (what apps see): glxinfo -B
  • Detailed hardware info (including vendor): sudo lshw -C display
  • Kernel DRM driver in use: ls -l /sys/class/drm/card0/device/driver

Frequently Asked Questions

How do I list all GPUs including integrated and discrete?

Run lspci | grep -E 'VGA|3D'. This will show both the integrated Intel GPU and the discrete NVIDIA/AMD GPU. On many laptops, both appear.

Why does nvidia-smi show no GPUs?

This usually means the NVIDIA driver is not installed or not loaded. Check with lsmod | grep nvidia. If you have a hybrid graphics laptop, you may need to switch to the NVIDIA GPU using prime-select or a BIOS setting.

Can I list GPUs without installing any extra tools?

Yes, lspci is part of the pciutils package, which is installed by default on most distributions. The kernel also exposes information via /sys/class/drm.

What is the difference between lspci and lshw output?

lspci reads the PCI configuration space directly and is very fast. lshw probes multiple subsystems (including DMI) and gives a more human-readable summary, but it may require root privileges to show full details.

How can I see GPU memory usage on AMD/Intel?

Use glxinfo -B for total memory, or cat /sys/class/drm/card0/device/mem_info_vram_total and mem_info_vram_used (AMD only). For Intel, use intel_gpu_top (from intel-gpu-tools).

Is there a GUI tool to list GPUs?

Yes, many desktop environments have a system info tool. For example, GNOME's "Settings > About" shows the graphics card. KDE's kinfocenter also lists GPUs. These are just frontends to the same underlying commands.