System and processes

The dd command

Copies data at a low level, block by block. Used to clone disks, create images and fill files.

Syntax

dd if=ORIGEN of=DESTINO [bs=TAMAÑO] [count=N]

Most useful options

if=Input file or device
of=Output file or device
bs=Block size
count=Number of blocks to copy

Copy-ready examples

$ printf 'datos\n' > a.txt && dd if=a.txt of=b.txtCopy a file
$ dd if=/dev/zero of=ceros.bin bs=1 count=4Create 4 zero bytes

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • With if/of it is easy to slip and overwrite a whole disk: always double-check the of=.

Related commands

FAQ

What is dd actually used for?

To clone disks, create bootable USB sticks or generate test files.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course