Commands · Command
CommandLinuxmacOS
fdisk
fdisk [device] (interactive) or fdisk -l (list partitions)A partition table editor for creating, deleting, and inspecting partitions on a disk.
// FLAGS
-llist all partitions on all detected disks, non-interactively// EXAMPLE
fdisk -l — prints every disk and its partitions, sizes, and types without entering the interactive editor.
// GOTCHA
fdisk's classic (MBR-oriented) interface can mishandle GPT disks larger than 2TB — gdisk or parted is the safer tool for modern GPT drives; on macOS, Apple recommends diskutil over the legacy BSD fdisk for anything beyond inspection.
// RELATED COMMANDS