Use lspci, lsscsi, lsusb, lsblk to display devices in Linux

There are a multitude of ways of listing numerous things within our Linux system. USB devices, PCI/PCI express cards, network details. and hard drives. We are now going to go through each one of those utilities.

Utilities available to use

The following system utilities will help get you started with searching for devices:

  • lspci
  • lsscsi
  • lsusb
  • lsblk

lspci

lspci lets you see connected PCI/PCI express devices. Such examples would involve network cards and graphics cards. In order to install it, run this command:

Debian/Ubuntu:

sudo apt-get install pciutils

CentOS/RedHat:

sudo yum -y install pciutils

When finished, just simply run lspci to get a list of PCI devices currently connected to your machine.

lsscsi

lsscsi will display information pertaining to disk drives attached to your system. Some examples would be SSDs, hard drives, CD-ROM, etc. In order to install:

Debian/Ubuntu:

sudo apt-get install lsscsi

CentOS/RHEL

sudo yum -y install lsscsi

When done, just simply run the command lsscsi in shell to display currently connected drives,

lsusb

lsusb will display your connected usb devices. This can widely range from usb drives to network adapters. Run this command to install it:

Debian/Ubuntu:

sudo apt-get install usbutils

CentOS/RHEL:

sudo yum -y install usbutils

Once you’ve finished installing usbutils. It is as simple as running the lsusb command to display your connected devices.

lsblk

lsblk will display information related to block devices. These sort of devices displayed are mostly storage such as hard drives, CD/DVD, USB drives, etc. In order to install this program, run this:

Debian/Ubuntu:

sudo apt-get install util-linux

CentOS/RHEL:

sudo yum -y install util-linux-ng

Run lsblk to display a list of block devices.

Usually these programs have been already installed in your Linux distribution. When doing a minimal installation involving only the bare system, these should definitely come in handy.