45

I'm going to purchase a GPU which is for PCI-e 3.0. But since I don't know what PCI-e slot it is in my computer I need to find it out somehow. Is it possible to find it from the terminal in linux?

1
  • 2
    Not asked, but nice to know: A PCI-e v3 card will run fine on an PCI-e v2 slot.
    – Hennes
    Apr 23, 2014 at 18:41

2 Answers 2

40

Using lspci -vv as root, you can get the transfer rate and compare it with the transfer rate specified for the revisions. A sample output would read:

# lspci -vv | grep -E 'PCI bridge|LnkCap'
00:02.0 PCI bridge: NVIDIA Corporation C51 PCI Express Bridge (rev a1) (prog-if 00 [Normal decode])
                LnkCap: Port #2, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <4us
00:03.0 PCI bridge: NVIDIA Corporation C51 PCI Express Bridge (rev a1) (prog-if 00 [Normal decode])
                LnkCap: Port #1, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <4us
00:04.0 PCI bridge: NVIDIA Corporation C51 PCI Express Bridge (rev a1) (prog-if 00 [Normal decode])
                LnkCap: Port #0, Speed 2.5GT/s, Width x16, ASPM L0s L1, Latency L0 <512ns, L1 <4us
00:10.0 PCI bridge: NVIDIA Corporation MCP51 PCI Bridge (rev a2) (prog-if 01 [Subtractive decode])

Which shows that the speed here is 2.5GT/s, corresponding to PCIe 1.x.

4
  • 14
    This needs to run as root; without it, lspci silently prints Capabilities: <access denied>, which is removed by the grep.
    – FauxFaux
    Jul 5, 2017 at 19:29
  • 21
    That's what the # means.
    – goetz
    Aug 13, 2017 at 23:12
  • 1
    That shows the CURRENT transfer speed. An idle system will all show the lowest speed it is allowed to run at. You can't use this at all.
    – Ken Sharp
    Sep 27, 2021 at 4:05
  • 2
    @KenSharp My understanding is that LnkCap is the link capability, not the current throughput rate. Do you have a source for your claim?
    – quazgar
    Sep 28, 2021 at 7:59
24

You can use the "dmidecode" command to give an in depth list of all the hardware on the system and then view that. I did a "quick and dirty" command to show the pertinent bit as follows:

dmidecode | grep "PCI"

Which returned

PCI is supported
Type: x16 PCI Express 2 x8
Type: x8 PCI Express 2 x4
Type: x8 PCI Express 2 x4
Type: x8 PCI Express 2 x4
Type: 32-bit PCI
3
  • 9
    dmidecode --type 9 can also be used to filter while keeping the rest of the information.
    – BenC
    Jan 19, 2016 at 2:24
  • 9
    only shows "Type: x16 PCI Express" for me. So no PCIe version...
    – Matt
    Jul 4, 2021 at 16:42
  • I think this lists the slot native speed but if the BIOS has a slot set to previous generation or an older card is dropping the slot generation I don't think this reflects it.
    – BoeroBoy
    Jan 24, 2023 at 14:13

You must log in to answer this question.

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