commands

fdisk — Inspect or edit partition tables

List partition information for a private regular image. Interactive editing may write partition metadata. Do not select real devices. Use a fresh private workspace; live operations are VM-only.

Formal Syntax & Structure

linux syntaxlinux
fdisk -l IMAGE

Parameters & Attributes

NameTypeDescription
-loptionList
IMAGEoperandPrivate regular image

Return Value

exit status and output

The listing form reports partition table information for the private image. Inspect diagnostics if the image cannot be read; a successful listing does not certify partition contents or filesystem integrity.

Working Example

Example Snippetlinux
test ! -e ./disk.img && test ! -L ./disk.img || exit 1(set -o noclobber; : > ./disk.img) || exit 1truncate -s 33554432 ./disk.img || exit 1test -f ./disk.img && test ! -L ./disk.img || exit 1fdisk -l ./disk.img
Linux Reference