BLOG POSTS
List PCI and USB Devices with lspci and lsusb

List PCI and USB Devices with lspci and lsusb

Why Should You Care About Listing PCI and USB Devices?

If you’re running a VPS, a dedicated server, or even a Docker container in the cloud, you might think hardware details are someone else’s problem. But here’s the thing: knowing what PCI and USB devices are available (and how to list them) can save you hours of troubleshooting, help you optimize performance, and even unlock new features for your projects. Ever tried to pass through a GPU to a VM? Or wondered why your USB backup drive isn’t showing up? Or maybe you’re just curious about what’s really under the hood of that “cloud” server you’re renting. That’s where lspci and lsusb come in. These are the Swiss Army knives for hardware detection on Linux, and they’re way more useful than most people realize.

What’s the Big Deal? Three Key Questions

  • How can I see what hardware is actually connected to my server or VM?
  • How do I quickly diagnose missing devices or driver issues?
  • What’s the fastest way to get device info for automation, scripting, or support tickets?

Let’s break down how lspci and lsusb answer these questions, and why you should care—even if you’re “just” renting a VPS or spinning up Docker containers.

How Does It Work? Under the Hood of lspci and lsusb

What is lspci?

lspci is a command-line utility that lists all PCI (Peripheral Component Interconnect) devices on your system. Think of PCI as the backbone for most internal hardware: network cards, GPUs, RAID controllers, sound cards, and more. If it’s plugged into the motherboard, it probably shows up here.

What is lsusb?

lsusb does the same thing, but for USB (Universal Serial Bus) devices. This includes everything from external hard drives and webcams to Wi-Fi dongles and even some virtual devices in cloud environments.

How Do They Get This Info?

  • lspci reads from /proc/bus/pci or /sys/bus/pci (depending on your kernel and distro), then decodes the raw data using a database of vendor and device IDs.
  • lsusb queries /proc/bus/usb or /sys/bus/usb, and also uses a database to translate those mysterious hex codes into human-readable names.

Both tools are part of the pciutils and usbutils packages, respectively. They’re available on pretty much every Linux distro out there.

Quick Setup: Get lspci and lsusb Working in Seconds

Step 1: Install the Tools

Most distros have these pre-installed, but if you’re on a minimal image (hello, Docker!), you might need to add them:

# Debian/Ubuntu
sudo apt update
sudo apt install pciutils usbutils

# CentOS/RHEL
sudo yum install pciutils usbutils

# Alpine (for containers)
apk add pciutils usbutils

Step 2: Run the Commands

To list all PCI devices:

lspci

To list all USB devices:

lsusb

Want more detail? Add -v (verbose):

lspci -v
lsusb -v

Need to see which kernel driver is attached (super useful for troubleshooting!):

lspci -k

Step 3: Use in Scripts or Automation

Both commands can be used in scripts to check for devices, automate hardware checks, or generate reports. For example, to list all NVIDIA GPUs:

lspci | grep -i nvidia

Real-World Examples: The Good, The Bad, and The Geeky

Scenario lspci/lsusb Output What It Means Advice
GPU passthrough for VM lspci shows “VGA compatible controller: NVIDIA Corporation…” GPU is visible to host, ready for passthrough Check lspci -k to see if the right driver is loaded
Missing USB backup drive lsusb does NOT show the device Device not detected at all Check cables, power, or try a different port. If in VM, check USB passthrough settings.
Cloud VPS with “virtual” devices lspci shows “Virtio network device” Provider is using paravirtualized hardware for speed Good! But you can’t attach real PCI devices in most clouds.
Docker container, no devices listed lspci/lsusb output is empty Container is isolated from host hardware Use --privileged or --device flags to pass through devices (with caution!)

Beginner Mistakes and Common Myths

  • “I don’t need these on a VPS!” – Wrong! Many VPS providers offer GPU, USB, or custom hardware passthrough. You need to check what’s really available.
  • “If it’s not listed, it’s not there.” – Not always. Sometimes devices are hidden by virtualization, or require special kernel modules to show up.
  • “lsusb only lists physical devices.” – Nope. Some virtual devices (like USB-over-IP) will show up too.
  • “lspci and lsusb are just for diagnostics.” – They’re also great for inventory, automation, and compliance checks!

Similar Tools and Alternatives

  • lshw – Shows a full hardware tree, but slower and more verbose.
  • hwinfo – Even more detailed, but not always installed by default.
  • dmidecode – Great for BIOS/firmware info, but not for live device detection.
  • udevadm info – For deep dives into device properties.

But for quick, no-nonsense device lists, lspci and lsusb are hard to beat.

Interesting Facts and Non-Standard Usage

  • PCI/USB IDs are standardized globally – That’s why lspci and lsusb can tell you the manufacturer and model, not just a hex code.
  • Update your ID databases! – Run update-pciids and update-usbids to get the latest device names.
  • Use in monitoring scripts – Want to know if someone hot-plugs a USB device? Monitor lsusb output and trigger alerts.
  • Audit for compliance – Need to prove no unauthorized USB storage is attached? Script lsusb checks and log the output.
  • Cloud hardware surprises – Some cloud providers let you attach real USB devices (e.g., for licensing dongles) or GPUs. Always check with lspci and lsusb before assuming what’s possible.

Automation and Scripting: Unlocking New Possibilities

Once you know how to list devices, you can:

  • Automate hardware inventory – Run lspci and lsusb on boot, save to a log, and track changes over time.
  • Detect hardware failures – If a device disappears, trigger a support ticket or self-healing script.
  • Dynamic configuration – Automatically load drivers or configure services based on detected hardware.
  • Security monitoring – Alert on new or unauthorized USB devices (great for physical servers in the datacenter).

Comparison Table: lspci vs lsusb vs lshw

Tool Best For Speed Detail Level Default Install?
lspci PCI devices (internal hardware) Fast Medium-High Usually
lsusb USB devices (external/peripheral) Fast Medium Usually
lshw Full hardware tree Slow Very High No

Stats: How Often Do People Use These?

  • lspci is in the top 1000 most-used Linux commands (according to command-not-found.com).
  • lsusb is less common, but essential for anyone dealing with external devices or security audits.
  • Both are included in almost every Linux sysadmin toolkit and are referenced in thousands of StackOverflow/serverfault posts.

Conclusion: Why, How, and Where to Use

If you’re running anything from a cloud VPS to a bare-metal dedicated server, knowing how to list PCI and USB devices is a must-have skill. Whether you’re troubleshooting, planning an upgrade, automating inventory, or just geeking out on what’s inside your box, lspci and lsusb are your go-to tools. They’re fast, reliable, and work everywhere Linux does.

  • For VPS users: Check what hardware is virtualized or available for passthrough. Order a VPS and see for yourself!
  • For dedicated server admins: Audit all hardware, plan upgrades, and monitor for rogue devices. Get a dedicated server and take full control.
  • For Docker/container fans: Know the limits of hardware access, and use lspci/lsusb for debugging when you need to pass through devices.

Don’t wait until something breaks. Add lspci and lsusb to your toolbox today, and you’ll be ready for whatever your hosting adventure throws at you!

Official resources:



This article incorporates information and material from various online sources. We acknowledge and appreciate the work of all original authors, publishers, and websites. While every effort has been made to appropriately credit the source material, any unintentional oversight or omission does not constitute a copyright infringement. All trademarks, logos, and images mentioned are the property of their respective owners. If you believe that any content used in this article infringes upon your copyright, please contact us immediately for review and prompt action.

This article is intended for informational and educational purposes only and does not infringe on the rights of the copyright owners. If any copyrighted material has been used without proper credit or in violation of copyright laws, it is unintentional and we will rectify it promptly upon notification. Please note that the republishing, redistribution, or reproduction of part or all of the contents in any form is prohibited without express written permission from the author and website owner. For permissions or further inquiries, please contact us.

Leave a reply

Your email address will not be published. Required fields are marked