Skip to content

dd command

Copy raw data between files and devices: disk images, bootable USBs, test files.

On this page

Syntax

dd if=INPUT of=OUTPUT [bs=SIZE] [count=N] [status=progress]

Provided by the coreutils package. Run man dd for the full manual.

Common options

OptionWhat it does
if=FILEInput file or device
of=FILEOutput file or device
bs=SIZEBlock size, e.g. 4M
count=NCopy only N blocks
status=progressShow progress
conv=fsyncFlush to disk before finishing

Examples

  1. Write an ISO to a USB drive

    sudo dd if=ubuntu.iso of=/dev/sdX bs=4M status=progress conv=fsync
  2. Back up a disk to an image

    sudo dd if=/dev/sda of=/backup/sda.img bs=4M status=progress
  3. Restore an image

    sudo dd if=/backup/sda.img of=/dev/sda bs=4M status=progress
  4. Create a 1 GB test file

    dd if=/dev/zero of=test.img bs=1M count=1024
  5. Test write speed

    dd if=/dev/zero of=./speedtest bs=1G count=1 oflag=dsync

Tips

  • Check the device name with lsblk first: dd overwrites without asking.

dd guides

← All Linux commands · Suggest a fix

Back to top