How To Use Linux To Find The Names Of The Devices On Your Computer

List Devices Using Linux
List Devices Using Linux.

This guide will show you how to list the devices, drives, PCI devices and USB devices on your computer. For finding out which drives are available you will briefly be shown how to show the mounted devices, and then you will be shown how to show all the drives.

Use The Mount Command

In a previous guide, I showed how to mount devices using Linux. Now I will show you how to list the mounted devices.

The most simple syntax you can use is as follows:


The output from the above command is fairly verbose and will be something like this:

/dev/sda4 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relat

There is so much information that it really isn't that easy to read.

Hard drives generally start with /dev/sda or /dev/sdb so you can use the grep command to reduce the output as follows:

mount | grep /dev/sd

The results this time will show something like this:

/dev/sda4 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

This doesn't list out your drives but it does list out your mounted partitions. It doesn't list partitions that aren't yet mounted.

The device /dev/sda usually stands for hard drive 1 and if you have a second hard drive then it will be mounted to /dev/sdb. If you have an SSD then this will likely be mapped to /dev/sda and the hard drive mapped to /dev/sdb.

As you can see my computer has a single /dev/sda drive with 2 partitions mounted. The /dev/sda4 partition has an ext4 filesystem and it is where Ubuntu is installed. The /dev/sda1 is the EFI partition used to boot the system in the first place.

This computer is set up to dual boot with Windows 10. In order to see the Windows partitions, I will need to mount them.

Use lsblk To List Block Devices

Mount is OK for listing mounted devices but it doesn't show every device you have and the output is very verbose making it difficult to read.

The best way to list out the drives in Linux is to use lsblk as follows:


The information is displayed in a tree format with the following information:

  • Name
  • Major Minor version number
  • Is it removable
  • Size
  • Is it readonly
  • Is it a disk or a partition
  • Where is the partition mounted

The display looks something like this:

  • sda - 8.0 - 0 - 931 GB - 0 - disk 
    • sda1 - 8.1 - 0 - 500M - 0 - part - /boot/efi
    • sda2 - 8.2 - 0 - 128M - 0 - part
    • sda3 - 8.3 - 0 - 370.6 G - 0 - part 
    • sda4 - 8.4 - 0 - 554.4 G - 0 - part /
    • sda5 - 8.5 - 0 - 5.9G - 0 - part - [SWAP]
  • sr0 - 11:0 - 1 - 1024M - 0 - rom

The information is much easier to read. You can see that I have one drive called sda which has 931 gigabytes. SDA is split into 5 partitions 2 or which are mounted and a third which is assigned to swap.

There is also a drive called sr0 which is the built-in DVD drive.

How To List PCI Devices

One thing that it is really worth learning about Linux is that if you want to list anything then there is usually a command which starts with the letters "ls".

You have already seen that "lsblk" lists out block devices and can be used to show the way disks are laid out.

You should also know that the ls command is used to get a directory listing.

Later on, you will use the lsusb command to list out the USB drives on the computer.

You can also list out devices by using the lsdev command but you will need to make sure procinfo is installed in order to use that command.

To list out the PCI devices use the lspci command as follows:


The output from the above command is again very verbose meaning you probably get more information than you bargained for.

Here is a short snapshot from my listing:

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Grap
hics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family US
B xHCI Host Controller (rev 04) 

The listing lists everything from VGA controllers to USB, sound, Bluetooth, wireless and ethernet controllers.

Ironically the standard lspci listing is considered basic and if you want more detailed information about each device you can run the following command:

lspci -v

The information for each device looks something like this:

02:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)
    Subsystem: Dell AR9485 Wireless Network Adapter
    Flags: bus master, fast devsel, latency 0, IRQ 17
    Memory at c0500000 (64-bit, non-prefetchable) [size=512K]
    Expansion ROM at c0580000 [disabled] [size=64K]
    Kernel driver in use: ath9k
    Kernel modules: ath9k

The output from the lspci -v command is actually more readable and you can clearly see that I have a Qualcomm Atheros wireless card.

You can get even more verbose output by using the following command:

lspci -vv

If that isn't enough try the following:

lspci -vvv

And if that isn't enough. No, I'm only kidding. It stops there.

The most useful aspect of lspci other than listing out devices is the kernel driver that is used for that device. If the device isn't working it is possibly worth researching whether there is a better driver available for the device.

List The USB devices Attached To The Computer

To list out the USB devices available for your computer use the following command:


The output will be something like this:

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 0c45:64ad Microdia
Bus 001 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 007: ID 0cf3:e004 Atheros Communications, Inc.
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 0bc2:231a Seagate RSS LLC
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 054c:05a8 Sony Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

If you insert a USB device into the computer such as an external hard drive and then run the lsusb command you will see the device appear in the list.


To summarize then, the best way to list anything out in Linux is to remember the following ls commands:

  • ls - list files in the file system
  • lsblk - list the block devices (i.e. drives)
  • lspci - list the pci devices
  • lsusb - list the USB devices
  • lsdev - list all the devices