How to Check PCI Slots in Linux

PCI slots and PCI express slots are everywhere. Since the bus is even used inside of netbooks and ultrabooks, you’ll probably need to check a little bit of information about them from time to time in the most unlikely of places. GNU/Linux includes a couple of commands that let you find out more about PCI slots then you might have ever cared to know. These commands are perfect for trying to fix networking problems, and they’re also good for anyone who builds their own equipment. Technicians use them to repair problems as well.

You’ll need to be working from the Linux command line to measure PCI slots in this way. Hold down Ctrl, Alt and T in a graphical desktop environment to start up a shell. You might also wish to click on the Applications or Whisker menu, head to System Tools and click or tap Terminal. Ubuntu Unity users will want to search for the word terminal from the Dash. Headless server operators can always use one of the virtual terminals as well, but some of these commands are a bit long if you’re not loading them from a shell script.

Method 1: View PCI Slot Information

At it’s most basic, you can simply type lspci and push enter to get a wealth of information about all of the devices attached to your system. This is likely to scroll off your terminal window, so you might want to use the scroll bar to read up on it. You may want to use the scroll wheel or touchpad if you have one to have a look through all of the information. This command, given with no other arguments,  will list every device attached to your system via the PCI bus. While it might give you a wall of text, it’s a very easy command to use.

Method 2: Check Ethernet PCI Slot Information

While this is an awfully large amount of data, you can always use grep to make your day much easier. One of the most used tricks for checking the PCI slots index is to instantly collect information on your Ethernet controller. It’s hand when you’re having issues with it. Type lspci -vmm | grep -B1 -A2 ‘^Class.*Ethernet’ at the command line and push enter. More than likely, that’s a huge bit of text to parse through, so you can copy it and then paste it on the command line. Either click on the Edit menu and select Paste or hold down Shift, Ctrl and V at the same time to paste it. The standard Ctrl+V keyboard shortcut you might be used to won’t work here, because the terminal interprets that differently. As soon as you push enter, you’ll receive information about your Ethernet adapter.

You’ll notice that the information you receive will tell you which slot it’s installed it and what hardware vendor shipped the particular card. It should also tell you a bit more information about the device itself.

Method 3: Displaying Open PCI Slots

Back at the terminal, you can run sudo dmidecode -t 9 | grep -A3 “System Slot Information” | grep -c -B1 “Available” to find out just how many PCI slots you have that are empty. Once again, this is a very long command that wouldn’t be practical to key in over and over again. Therefore, you may wish to copy it and again either click on the Edit menu then select Paste or hold down Ctrl, Shift and V to paste it into the terminal window.

Note that the sudo command is in the front of this particular command line stack. That’s because enumerating the exact list of PCI slots requires root access. You’ll be asked for your password once you try to run it, then it will return a single number. This could be as low as 0 or 1 on a system with few real physical PCI slots to as high as 8-10 on some types of servers.

You might receive some unusual or at least unexpected results if you run any of these commands inside of a virtual machine. Most VM software environments will emulate a series of PCI slots, but whether or not their specific values make any sense is something else.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.