dd command
Copy raw data between files and devices: disk images, bootable USBs, test files.
- Disks & storage
- Package coreutils
- 6 options · 5 examples
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
| Option | What it does |
|---|---|
if=FILE | Input file or device |
of=FILE | Output file or device |
bs=SIZE | Block size, e.g. 4M |
count=N | Copy only N blocks |
status=progress | Show progress |
conv=fsync | Flush to disk before finishing |
Examples
Write an ISO to a USB drive
sudo dd if=ubuntu.iso of=/dev/sdX bs=4M status=progress conv=fsyncBack up a disk to an image
sudo dd if=/dev/sda of=/backup/sda.img bs=4M status=progressRestore an image
sudo dd if=/backup/sda.img of=/dev/sda bs=4M status=progressCreate a 1 GB test file
dd if=/dev/zero of=test.img bs=1M count=1024Test write speed
dd if=/dev/zero of=./speedtest bs=1G count=1 oflag=dsync
No example matches. Check the options table or search the guides.
Tips
- Check the device name with
lsblkfirst: dd overwrites without asking.
dd guides
- How to Backup and Clone Disk Partitions using dd Command in Linux Linux Commands · Updated Apr 2025
- dd Command in Linux (Syntax, Options and Use Cases) Linux Commands · Updated Apr 2025
- 15 Practical Examples of dd Command in Linux Linux Commands · Updated Apr 2025
- YYYY-MM-DD Date Format In A Shell Script Shell Scripting · Updated Apr 2025
