List drives in Ubuntu
How To

List Drives in Ubuntu Command Line

Sagar Sharma
Sagar Sharma

Table of Contents

Wondering what partitions and drives are on your Ubuntu system?

The lsblk command is widely used for listing mounted drives including their mount points.

use lsblk command to list drives in ubuntu

No additional option and you get a list of mounted drives with partitions and mounting points.

But wait, there are more ways to list drives in Ubuntu Linux, and I will discuss them one by one.

1. Using fdisk command

The fdisk utility is mainly used to manipulate the disk partition table but when used with -l option brings the list of partition tables for specific devices.

fdisk -l
use fdisk command to list drives in ubuntu

2. Using df command

The df (disk free) command is mainly used to display free and used disk space for each file system.

And by default, the free and used space will be shown for 1k blocks meaning you'd have to divide free/used space with 1024 to get values in Mbs.

But that can easily be overcome by using -h option to improve readability.

df -h 
use df command to list drives in ubuntu
DigitalOcean – The developer cloud
Helping millions of developers easily build, test, manage, and scale applications of any size – faster than ever before.
Get started on DigitalOcean with a $100, 60-day credit for new users.

3. Using parted command

As its name suggests, the parted utility is a powerful tool to manipulate your partitions but when used with -l option to list partition layouts on all block devices.

sudo parted -l
use parted command to list drives in ubuntu

4. Using lshw command

The lshw command is used to get detailed info related to your machine's hardware ranging from exact memory configuration, firmware version, mainboard configuration to bus speeds.

And when used with -class disk, it will fetch detailed info about mounted drives.

sudo lshw -class disk
use lshd command to list drives in ubuntu

This utility can also give you the privilege to get output in HTML, JSON, or in XML formats.

For example, let me show you how you can get in HTML  

sudo lshw -class disk -html
use lsblk command to list drives and get output in html
Automate backups for cloud servers, websites & databases..
Automate backups for cloud servers, websites & databases..

5. By listing contents of /dev/disk

Unless you're an advanced user, I'd not recommend this method as beginners are bound to get confused with the representation of the output.

On the other hand, it is an effective way to list disks in a more meaningful way.

ls -l /dev/disk/by-id
list drives in ubuntu by lsiting contents of /dev/disk

Similarly, you can also use the following instead of listing contents using by-id:

  • by-label
  • by-partlabel
  • by-partuuid
  • by-path
  • by-uuid

6. Using sfdisk command

The sfdisk is script oriented utility for manipulating disk partitions but can be used to list block devices (drives) by using -l options and gives an identical output to sudo fdisk -l command that I addressed earlier.

sudo sfdisk -l
use sfdiskcommand to list drives in ubuntu


This guide was a compilation of different methods through which you can easily list drives on your Ubuntu system.

I recommend using the lsblk and fdisk commands as they are more popular and straightforward. But feel free to use the ones you feel comfortable with.