dd

Linux · Files · available in the simulator

What it does

Copies and converts data block by block between files and devices. It is used to clone disks, create images or generate test files.

Syntax

dd [operando=valor]...

Options and parameters

  • if=fichero

    Input file or device; if omitted, it reads from standard input.

  • of=fichero

    Output file or device; if omitted, it writes to standard output.

  • bs=tamaño

    Block size for reading and writing, such as 4M.

  • count=N

    Copies only N input blocks.

  • skip=N

    Skips N blocks at the start of the input.

  • seek=N

    Skips N blocks at the start of the output.

  • status=progress

    Shows copy progress while it works.

  • conv=fsync

    Forces the data to be physically written before finishing.

Usage examples

  • dd if=/dev/zero of=vacio.img bs=1M count=10

    Creates a 10 MiB file filled with zeros.

  • dd if=disco.img of=copia.img bs=4M status=progress

    Copies an image while showing progress.

  • dd if=/dev/urandom of=aleatorio.bin bs=1K count=64

    Creates a 64 KiB file of random data.

  • dd if=imagen.iso of=/dev/sdX bs=4M status=progress conv=fsync

    Writes an image to a USB device. Replace sdX with great care.

Notes and common mistakes

  • dd does not ask for confirmation: a wrong of= on a device such as /dev/sda destroys its data without warning.
  • That is why it is jokingly called the disk destroyer; in the simulator it is safe to practice.
  • Always check the target device with lsblk before writing.
Practise dd

Related commands