The Ultimate Guide: Easily List Partitions in Ubuntu

The Ultimate Guide: Easily List Partitions in Ubuntu

Discover efficient ways to list partitions in Ubuntu with command-line utilities Gain insights into what a partition is and explore tools like fdisk, sfdisk, df, lsblk, lshw, pydf, hwinfo, and parted Choose the perfect utility to effortlessly view and manage your partitions

Key Takeaways

Partitions are how your storage devices are divided up into pieces.

To view your partition table, use one of the following commands: fdisk -l, sfdisk -l, df -h, lsblk, lshw, pydf, hwinfo, or parted -l.

For a basic overview of your partitions, run lsblk. If you need to manipulate your partitions, use parted -l.

Figuring out how drives are partitioned isn't a task you'll have to perform daily, but it is crucial to know how to do it when necessary. Here, you'll find eight fast methods to accomplish this on Ubuntu.

What is a Partition?

A partition, as the name suggests, is a section of storage on a drive that has been formatted with a specific file system. Before any storage device, whether it is a modern NVMe SSD or an older hard disk drive, can be used, it needs to be partitioned. Typically, a drive has only one partition, but boot drives often have additional small partitions for storing the bootloader or recovery data.

At times, it may be necessary to manage partitions for troubleshooting purposes, managing operating system installations, or various other tasks. While we have focused on Ubuntu in this case, these methods can also be applied with minimal adjustments in most other Linux distributions.

List Your Partitions with fdisk

Fdisk is technically a program for the creation and management of partitions, however it can also just display them. Open up the Terminal, then run:

sudo fdisk -l

The Ultimate Guide: Easily List Partitions in Ubuntu

Use sfdisk to List Partitions

Fdisk is a moderately readable option that provides comprehensive information along with a tidy and easily understandable format. If you are looking for a rapid partition list, fdisk should be one of your top choices.

To list your partitions using sfdisk, open Terminal and execute the following command:

sudo sfdisk -l

Note: Sfdisk has a similar visual appearance and usage as fdisk. However, it lacks interactivity and cannot handle GPT partitions. Sfdisk is typically employed for partition manipulation through scripting purposes.

The Ultimate Guide: Easily List Partitions in Ubuntu

Use df to View Partition Information

The disk free utility, commonly known as "df," is a straightforward tool for viewing the disk space of partitions on Linux systems. It is relatively basic compared to other available options and may not be suitable if you require in-depth information. To execute the command, enter the following in the Terminal:

df -h

The Ultimate Guide: Easily List Partitions in Ubuntu

Use lsblk to Get Information About Partitions

The lsblk command is a utility that provides information about storage devices, specifically block devices, on your system. It offers various arguments, but if you require a brief overview of your system's partitions, the basic lsblk command is ideal. To access the Terminal, simply launch it and execute the following command:

lsblk

The Ultimate Guide: Easily List Partitions in Ubuntu

Use lshw to Retrieve Information About your Storage Hardware

lshw is a command-line tool that resembles the System Information Panel in Windows. Unlike the latter, lshw provides detailed information about all the hardware components of your PC, including storage devices. To filter through the cluttered output, look for entries labeled *-disk:# and *-volume:#. To access lshw, open a Terminal and run the following command: lshw

The Ultimate Guide: Easily List Partitions in Ubuntu

Use pydf to List Partitions with Colors

Pydf serves as a more advanced version of the standard df command, offering the same functionality while prioritizing enhanced customizability and improved readability of the output. Keep in mind that Pydf is not typically preinstalled on Linux distributions. To install Pydf, execute the following command:

sudo apt install pydf

Once the installation has finished, run:

pydf

Make a note of the colors, and how they correspond to different device types.

Use hwinfo to Find Details About Your Storage Devices and Partition Tables

Hwinfo, also known as "Hardware Info," is a software tool that offers comprehensive details about the various hardware components of your computer. Unlike lshw, which primarily focuses on storage devices and their partition tables, hwinfo provides information about all hardware components. To obtain this useful tool, simply execute the following command:

sudo apt install hwinfo

Once hwinfo is installed, run the following command to get a simplified overview of your partitions:

hwinfo --block --short

The Ultimate Guide: Easily List Partitions in Ubuntu

If you want more details about your partitions and your physical drives, just omit the --short argument.

hwinfo --block

Use parted to View and Manage Partitions

Parted, the partition editor integrated in most Linux distributions, is highly robust and advantageous to acquaint oneself with. To simply view a list of partitions, execute the following command in the Terminal:

sudo parted -l

The Ultimate Guide: Easily List Partitions in Ubuntu

Use parted with a GUI (gparted)

Parted primarily functions as a command-line interface (CLI) utility, but it also offers a graphical user interface (GUI). The GUI variant can be easily accessed on Linux by either searching for "gparted" in the app drawer or launching it via the Terminal. To open it using the Terminal, simply execute the following command:

sudo gparted

The Ultimate Guide: Easily List Partitions in Ubuntu

You can do everything you normally do with parted, except it has a user interface, too!

Which Utility Should You Use to View Partitions?

There really is no concrete answer here. The commands vary in detail, permission requirements, and functionality, and which you use will depend on what you're doing.

However, we've generally found ourselves using three more than the others, those are:

parted (both the CLI and GUI variants)

lsblk

fdisk

The reason for choosing Parted is due to its exceptional power and versatility. lsblk is incredibly convenient as it can be executed without needing elevated permissions, making it particularly useful when working on a system without sudo access. Additionally, fdisk is a reliable option as it offers a straightforward interface and effectively presents the required information.