Linux Command: fdisk

Published on March 24, 2022 at 5:53 pm by LEW


A common task in any Operating System (OS) is setting up a drive, be it SSS, mechanical, or USB. Most OS’s have a graphical utility for this purpose, and Linux is no exception, with several available. However, you should know how to setup and partition your drive form the command line with a program like fdisk.

The fdisk command allows us to view, manipulate, and delete partitions on any drive.

Syntax and Function

The fdisk program has the following syntax.

fdisk [options] device

fdisk -l [device]

The two most common ways of using the program are fdisk -l and fdisk device. When run with a device, fdisk enters a menu driven mode.

The fdisk program is one of a hand full of command line utilities for partitioning a drive. The first version It was introduced in 1993. In Linux fdisk is part of the util-linux package.


One of the more common options is -l, which lists partition tables of a specified device, or when no device is specified then all devices found in the /proc/partition directory.

fdisk -l

This will provide information on each device including the full path (needed to open individual devices), as well as information about existing partitions on each device.

The other common option for execution is with a device path (see above example).

fdisk /dev/sdc

Note the full path to the device is required. Device naming will depend on the type of device. Standard SATA drives are listed as sda through sdz. In this example, sdc is the third drive on the system. M2 drives are generally listed as nvme1, nvme2, ect. This command will open a menu system in fdisk. The following are some of the more common menu options.


Some of the more common command line op0tions for fdisk are as follows.

Refer to the manpage for a complete list of options.


This has been a quick overview of the fdisk command and some of the more common options/usage. It should cover most things an average user would need to do. Please refer to the manpage for your distribution for a complete list of all options and features.

Add New Comment

Your email address will not be published. Required fields are marked *