Smart Systems for Home

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

How to Check PCI Slots in Linux

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To check PCI slots in Linux, you can use the lspci command, which lists all PCI devices connected to your system. For detailed slot information (like physical slot numbers or bus addresses), combine it with lspci -v or use lshw. This guide shows you several methods, from quick commands to deeper hardware queries, so you can identify what's plugged into each PCI slot and which slots are free.

What You'll Need

  • A Linux system (any distribution) with a terminal.
  • Root or sudo access for some commands (like lshw or dmidecode).
  • Basic familiarity with the terminal (copy/paste commands).

Step-by-Step

  1. Open a terminal. Press Ctrl+Alt+T on most desktop environments, or use your app launcher to find "Terminal".
  2. Run the basic PCI list. Type lspci and press Enter. This shows a list of all PCI devices with their vendor, device name, and bus address (e.g., 00:1f.2). The output looks like:
    00:00.0 Host bridge: Intel Corporation ...
    The first part (like 00:00.0) is the PCI bus/device/function address, not the physical slot number.
  3. Get more detail with verbose mode. Run lspci -v to see additional info for each device, including IRQ, memory ranges, and sometimes the physical slot description (like "PCIe Slot 1"). This output is long, so you can scroll or pipe it to less: lspci -v | less.
  4. Check for empty slots using kernel messages. Run dmesg | grep -i pci to see boot-time PCI detection messages. Look for lines mentioning "pci_bus" or "slot"—they may indicate which slots are populated or empty. This is not always reliable, but it can help.
  5. Use lshw for a hardware overview. Install it if needed (sudo apt install lshw on Debian/Ubuntu, sudo dnf install lshw on Fedora). Then run sudo lshw -class bus to see a tree of PCI buses and devices. The output shows bus addresses and sometimes slot names (e.g., "PCI ExpressSlot 3").
  6. Use dmidecode for physical slot information. Run sudo dmidecode -t slot to list all physical PCI/PCIe slots on the motherboard, including which are occupied and which are free. This is the most direct way to see empty slots. Example output:
    Designation: PCIEX16_1
    Type: x16 PCI Express
    Current Usage: In Use
  7. Map devices to slots. If lspci shows a device at bus address 01:00.0, you can match it to a physical slot by cross-referencing the bus number with the slot info from dmidecode (though the mapping isn't always straightforward). For most users, lspci plus dmidecode -t slot gives enough info.

Common Mistakes

  • Confusing bus address with physical slot. The 00:1f.2 is a logical address, not the slot you see on the motherboard. Use dmidecode for physical slots.
  • Not using sudo when needed. Commands like lshw and dmidecode require root privileges to show full details. Without sudo, they may output partial or no info.
  • Assuming lspci shows empty slots. It only lists devices that are present. Empty slots are invisible to lspci.
  • Ignoring kernel message filtering. dmesg can be huge; using grep helps but may miss relevant lines if you filter too narrowly.

Tips

  • Use lspci -nn to show vendor and device IDs in numeric form, which helps identify unknown hardware.
  • For a quick visual, run lspci -tv to see a tree view of PCI buses and devices.
  • If you're planning to add a new card, check the available slot types (e.g., PCIe x16, x1) using dmidecode -t slot to ensure compatibility.
  • On laptops, many slots are soldered or not user-accessible; dmidecode may list them but they might not be physically available.
  • Save the output of lspci to a file for reference: lspci > pci_devices.txt.

Troubleshooting

If lspci returns nothing or an error:

  1. Ensure the pciutils package is installed. On Debian/Ubuntu: sudo apt install pciutils. On Fedora: sudo dnf install pciutils.
  2. Try running sudo lspci—some systems restrict access to the PCI database.
  3. If you still see nothing, your system may have a hardware issue or the PCI bus is not detected. Check dmesg | grep -i pci for errors.

If dmidecode -t slot shows no output or errors:

  1. Run it with sudo: sudo dmidecode -t slot. Without sudo, it often fails.
  2. If it says "No SMBIOS entry found", your system may use a different firmware (like UEFI without full SMBIOS). Try sudo dmidecode | grep -i slot as a fallback.
  3. Some virtual machines or older hardware may not expose slot information—this is normal.

If you can't identify which physical slot a device is in:

  1. Look at the bus number from lspci (e.g., 02:00.0). The bus number often correlates with the physical slot order, but not always.
  2. Use lspci -v and look for "Physical Slot" or "Slot" lines—some drivers report it.
  3. As a last resort, physically open the case and trace cables—but only if you're comfortable and the system is powered off.

Frequently Asked Questions

Can I see empty PCI slots with lspci?

No, lspci only lists devices that are present. To see empty slots, use sudo dmidecode -t slot which reports all physical slots and their usage status.

What does the PCI bus address mean?

It's a triplet like 00:1f.2: the first two numbers are the bus and device, the last is the function. It's a logical identifier, not a physical slot number.

Do I need to install anything to run lspci?

Most Linux distributions include pciutils by default. If not, install it via your package manager (e.g., sudo apt install pciutils).

Why does dmidecode require sudo?

Because it reads the system's SMBIOS/DMI firmware tables, which are protected. Without root, it can't access that data.

Can I check PCI slots on a laptop?

Yes, but many laptop slots are not user-accessible. The commands will still list them, but you may not be able to physically use them. For upgrades, check your laptop's manual.

How do I know if a PCIe slot is x16 or x1?

Use sudo dmidecode -t slot and look at the "Type" field (e.g., "x16 PCI Express"). Alternatively, check your motherboard's manual or the physical slot size.