الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

lspci

List the PCI devices (network cards, disk controllers, GPUs …) and the drivers that handle them.

المستوى
لينكس اليومي
المجموعة
النواة والعتاد
يحتاج root
للتغييرات
الحزمة
pciutils

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

lspci shows every device on the PCI bus with its vendor and model. -k adds the kernel driver in use and the modules that could drive it — the quick check that hardware works. -nn shows the numeric vendor:device IDs for searching drivers. Some details need root.

طريقة الكتابة

lspci [OPTION]...

الخيارات 22

الأكثر استخدامًا

Display

-k
Show the kernel driver in use and possible modules.
-v, -vv, -vvv
More and more details.
-nn
Names and numeric IDs (vendor:device).
-n
Only numeric IDs.
-t
Tree view of buses and bridges.
-m, -mm
Machine-readable output.
-b
Bus-centric view (IRQs and addresses as the card sees them).
-D
Always show the PCI domain.
-P, -PP
Show the path through bridges.
-x, -xxx, -xxxx
Hex dump of the config space (root for the full dump).
-q, -qq, -Q
Ask the online PCI ID database for unknown devices.

Select

-s [[[[DOMAIN]:]BUS]:][DEV][.[FUNC]]
Only this slot, like -s 00:03.0.
-d [VENDOR]:[DEVICE][:CLASS]
Only this vendor/device/class, like -d 8086:.

Data sources

-i FILE
Use this pci.ids file.
-p FILE
Use this modules.pcimap file.
-M
Bus mapping mode (full scan).
-A METHOD
Access method.
-O PARAM=VALUE
Library parameters.
-H1, -H2
Direct hardware access (old).
-F FILE
Read a hex dump from a file.
-G
Library debug.
--version
Show the version.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1All PCI devices

    lspci
    00:01.0 VGA compatible controller: Red Hat, Inc. Virtio 1.0 GPU (rev 01)
    01:00.0 Ethernet controller: Red Hat, Inc. Virtio 1.0 network device (rev 01)

    Slot, class and model.

  2. 2Devices with their drivers

    lspci -k
    01:00.0 Ethernet controller: Red Hat, Inc. Virtio 1.0 network device (rev 01)
    	Kernel driver in use: virtio-pci

    No "driver in use" = no driver loaded.

  3. 3Network cards only

    lspci | grep -i ethernet

    Then lspci -k -s SLOT.

  4. 4IDs for driver search

    lspci -nn | grep -i net
    01:00.0 Ethernet controller [0200]: Red Hat, Inc. Virtio 1.0 network device [1af4:1041] (rev 01)

    1af4:1041 = vendor:device.

  5. 5One device in detail

    lspci -vv -s 01:00.0

    Capabilities, link speed, IRQ.

  6. 6Tree view

    lspci -t

    Which device sits behind which bridge.

  7. 7Only Intel devices

    lspci -d 8086:

    Filter by vendor ID.

  8. 8Check the PCIe link speed of an NVMe disk

    lspci -vv -s 03:00.0 | grep -E 'LnkCap|LnkSta'

    A slower LnkSta than LnkCap = wrong slot or bad link.

  9. 9Update the ID database

    update-pciids

    Newer names for new hardware (needs internet).

  10. 10Hardware inventory for audits

    lspci -mm > /tmp/pci-$(hostname -s).txt

    Machine-readable list per host.

الملفات

/usr/share/hwdata/pci.ids
Names of vendors and devices.

رموز الخروج

0Done.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 lspci