I would like to see how many PCI slots I have in a server and how many of them are in use. Is this possible with just some Linux commands? (lspci doesn't seem to provide the exact information I need.)

2 Answers 2


May be you can use:

dmidecode -t 9

For getting number of slots:

dmidecode -t 9 | grep "System Slot Information" | wc -l

For getting count of available:

dmidecode -t 9 | grep -A3 "System Slot Information" | grep -c -B1 "Available"

More info dmidecode.

  • 1
    This will get you just the slots which on second thought seems like what you actually wanted.
    – Dylan
    Mar 19, 2015 at 22:57
  • 1
    I think this is what OP needs.
    – taliezin
    Mar 19, 2015 at 22:59
  • I agree, I offered an alternative but also gave you a +1! Never used dmidecode time to go read about it!
    – Dylan
    Mar 19, 2015 at 23:00
  • 1
    I would suggest -t slot instead of numeric identifier to make it easier to understand but otherwise, great answer! May 5, 2020 at 7:45

EDIT - What might be better for you is sudo lspci | grep PCI

I would recommend sudo lspci as this will tell you every port as well as when is plugged into them. Otherwise it will just list the port and something generic.

lspci man page excerpt:

lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

Keep in mind that this will list every interface on the bus not just what most would think of as traditional pci slots...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .