There is no one answer fits all as you have not specified Operating system, and on top of that, different motherboard manufacturers change the way their on board devices operate.
For example, an on board audio, on board ethernet or other devices can all present themselves to the operating system* as plugged in to a PCIe slot.
If you have a Windows machine, you can right click on Computer and then choose Manage. Go to Device Manager/Management and through the menu bar click View > Resources by connection. You can then expand Interrupt request (IRQ).
However, as I said, this can be unreliable, and it will not give an easy slot number/what is in it.
By far the easiest thing you can do, especially as you are going to open the computer up, is to open it up and just see what is in the sockets.
* To explain a little further, many devices do more than look like they are PCIe/PCI, Many actually are PCIe/PCI devices that are simply embedded on the motherboard.