Are you experiencing {hardware} points in your Linux machine? Or perhaps you are simply interested by what data you may collect utilizing terminal instructions? You must attempt these lspci command examples.

The lspci command line software offers you details about PCI (Peripheral Part Interconnect) bus techniques and gadgets linked to your PC’s motherboard. This contains gadgets reminiscent of your GPU, your Ethernet port, and your Wi-Fi card. In the event you’re acquainted with the ls command, then you may perceive the command’s identify: “record PCI”. Details about your machine’s inner techniques is just a few keystrokes away with lspci.

Test all PCI gadgets

Essentially the most primary use-case for lspci is getting a printout of all PCI gadgets linked to your system. You possibly can simply run lspci by itself to get a quick overview.

A Linux terminal showing the output of the lspci command with no flags.

You may see each entry seem first with the slot handle, a set of numbers and typically letters distinctive to the machine. There’s additionally a category listed, the seller identify, and the machine identify. You may additionally see subsystem vendor and machine names when subsystems exist. You would possibly see a revision quantity (like “rev 04”) and an related programming language on the finish too.

Take into account that the gadgets listed below are PCI gadgets. Whereas that features USB controllers, it doesn’t embody USB-connected peripherals. If you wish to see what USB gadgets are plugged into these controllers, then you definitely need the lsusb command.

Equally, in the event you’re attempting to work instantly together with your linked storage gadgets, then it is best to look into the lsblk command.

Seek for particular gadgets

OK, lspci’s output generally is a little overwhelming to eyeball if you’re attempting to determine one thing particular. With an help from the tried and true grep command, you may search for particular gadgets by search time period.

For instance, as an example you need to see all USB controllers. Simply run this command:

lspci | grep "USB"
A Linux terminal showing the output of the lspci command piped into grep filtering for the USB term.

It will filter out all outcomes that do not point out USB within the primary data.

Search phrases may be difficult although. For instance, your graphics card could or could not point out the phrase “graphics” or “GPU” anyplace in its machine identify. Nevertheless, I do know that the built-in GPU in use on my laptop computer has the phrase Iris in its identify, so I can run this command:

lspci | grep "Iris"
A Linux terminal showing the output of the lspci command piped into grep filtering for the Iris term.

As you may see, I efficiently discovered the iGPU on my laptop computer. It’d take some trial and error to filter appropriately in your Linux system. Strive completely different phrases that you understand could also be related together with your machine.

An opened PC with some of its components visible.


How to List Your Computer’s Devices From the Linux Terminal

Simpler than ripping it aside.

Get detailed data about gadgets

As an example you’ve got recognized an necessary machine. You may use different instructions to get additional data, however lspci is able to telling you fairly a bit about them itself in the event you use the verbose choice. This may be helpful particularly when somebody helps you troubleshoot your Linux system, a case the place realizing as a lot as attainable concerning the gadgets in play is at all times useful.

To get an in depth studying of all gadgets, run lspci with the -v flag, quick for “verbose”:

lspci -v
A Linux terminal showing the output of the lspci command with the -v flag.

Some data requires root to be viewable, so that you would possibly need to attempt sudo lspci -v you probably have permission. In any other case you may see entry denied in sure readouts.

The lspci command really has two extra ranges of verbosity you may entry by typing -vv or -vvv. You may find yourself with a ton of textual content to parse, although. Except you are a developer, you most likely will not achieve something helpful with these printouts.

If you wish to understand how the gadgets in lspci‘s output are associated to one another, you may run the -t choice to get every little thing organized right into a “tree.” By default, it can solely present you machine slots, however in the event you enhance verbosity, you may see names too.

lspci -tv
A Linux terminal with the results of an lspci -tv command.

See which driver your machine is utilizing

Typically it is helpful to know which driver your PCI machine is utilizing. Graphics drivers specifically are a topic of quite a lot of dialogue within the Linux world as a result of the one you’ve gotten put in typically is not the perfect one obtainable.

Fortuitously, the motive force being utilized by your GPU, or some other machine, is included in lspci‘s output. even with out root. For instance, we already recognized the iGPU on my laptop computer earlier at handle 00:02.0. I can examine which driver it is utilizing by operating this command:

lspci -ks 00:02.0
A Linux terminal showing kernel driver and moduel info for a device.

The -k flag will get us kernel data whereas, once more, the -s flag tells lspci you need simply the particular machine situated on the slot that follows.

Linux terminal, a search bar in the center, and Tux holding a magnifying glass.


11 Overlooked Linux Commands You Really Should Be Using

These instructions might considerably improve your workflow!

Get distinctive machine codes

Typically you might want to discover extra details about particular gadgets. lspci is ready to provide you with distinctive vendor and machine codes—extra distinctive than simply the machine identify—that you may then lookup on-line or give to the seller if you want specialised help with it.

All you might want to do is use the -nn flag, which will get you vendor and machine names and codes. For instance, I can get that data for my iGPU with this command:

lspci -nns 00:02.0
A Linux terminal showing the output of the lspci command with the -nns flags.

You possibly can see the output I get exhibits a set of codes on the finish: 8086:a7a0. 8086 is Intel’s vendor code, and a7a0 is the distinctive code for the built-in graphics machine put in in my PC. In the event you do an online seek for these codes, you may discover detailed data about it.


There are quite a lot of instructions for the Linux terminal which can be surprisingly helpful. The traceroute command could assist you to troubleshoot your web connection, and mastering the systemctl command will assist you to higher handle the providers operating in your machine.


Source link