fbpx Linux lspci Command: View PCI Devices and Hardware | Certificação Linux

Linux lspci Command: List PCI Devices and Connected Hardware

📅 01/01/2019 ⏱ 3 min ✍️ Uira Ribeiro
Linuxcommands
Linux lspci Command: List PCI Devices and Connected Hardware
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

During the system boot process, the Kernel detects the connected PCI devices. The list of found expansion cards can be read using the lspci command.

The lspci command in Linux is useful for displaying all information about the system's PCI buses and the devices connected to them.

Its most common options are: 

  • -v       Displays detailed information about all devices. 
  • -vv     Shows even more information about the devices. 
  • -n       Shows the vendor and device codes. 
  • -x.      Shows the first 64 bytes of the PCI configuration in hexadecimal. 
  • -xxx    Shows the entire PCI configuration in hexadecimal.

Example of use:

$ lspci
00:00.0 Host bridge: ALi Corporation M1541 (rev 04)
00:01.0 PCI bridge: ALi Corporation M1541 PCI to AGP Controller (rev 04)
00:02.0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
00:03.0 Bridge: ALi Corporation M7101 PMU
00:07.0 ISA bridge: ALi Corporation M1533 PCI to ISA Bridge [Aladdin IV]
00:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0b.0 SCSI storage controller: Adaptec AHA-2940/2940W / AIC-7871
00:0f.0 IDE interface: ALi Corporation M5229 IDE (rev c1)
01:00.0 VGA compatible controller: NVidia / SGS Thomson (Joint Venture) Riva128 (rev 10)

Systems that use the PCI bus most of the time do not require manual configuration of the expended resources.

You can check the addressing and interruption of devices by consulting the contents of the files /proc/interrupts and /proc/ioports.

$ cat /proc/interrupts
	CPU0
0:	288898893    XT-PIC timer
1:	230          XT-PIC keyboard
2:	0            XT-PIC cascade
5:	7085061      XT-PIC eth0
8:	2            XT-PIC rtc
9:	0            XT-PIC usb-ohci
10:	152038       XT-PIC aic7xxx
12:	411599       XT-PIC eth1
14:	2            XT-PIC ide0

To check the input and output ports:

$ cat /proc/ioports
0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0070-007f : rtc
0080-008f : dma page reg
5c20-5c3f : ALi Corporation. [ALi] M7101 PMU
b800-b80f : ALi Corporation. [ALi] M5229 IDE
d000-d0ff : Adaptec AHA-2940/2940W / AIC-7871
d000-d0ff : aic7xxx
d400-d4ff : 8139too
d800-d8ff : Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+

This way, to enable the hardware, you must load the corresponding kernel module for the device. To load the module, use the modprobe command followed by the module name:

# modprobe 8139too

Some non-PCI cards require that I/O addressing and IRQ be informed as arguments for the modprobe command to allocate resources correctly: 

# modprobe ne io=0x300 irq=10

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.

Liked it? Share

 

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp