Start·Terminal-Befehle

dd

Archive

Aufruf

dd if=<source> of=<target> bs=4M status=progress

Kopiert Block für Block — so schreibt man ein Installationsabbild auf ein Gerät; was in `of=` steht, wird ohne Rückfrage ab Block null überschrieben, und es gibt kein Zurück, also prüfen Sie das Gerät unmittelbar vor dem Enter noch einmal mit lsblk, nehmen `bs=4M` für Tempo und `status=progress` (unter macOS Ctrl+T) zum Mitschauen.

Häufige Optionen

OptionBedeutung
if=<file>Input file or device. Leaving it out reads stdin.
of=<file>Output. Whatever this names is overwritten from block zero, with no confirmation.
bs=4MBlock size. Too small and the copy crawls.
count=<n>Copy only n blocks.
status=progressShow progress (GNU). On macOS press Ctrl+T instead.
conv=fsyncFlush to the device before exiting, so the numbers mean something.
conv=notruncWrite in place without truncating the output file.

Beispiele

lsblk

Always confirm the device name immediately before the next command.

sudo dd if=ubuntu.iso of=/dev/sdb bs=4M status=progress conv=fsync

Write an installer image to a whole USB device (Linux).

diskutil unmountDisk /dev/disk4 && sudo dd if=ubuntu.iso of=/dev/rdisk4 bs=4m

On macOS the disk must be unmounted first, or dd fails with Resource busy; rdiskN is the fast raw path.

Bündeln und Komprimieren sind zwei Aufgaben: tar bündelt, gzip verkleinert, .tar.gz ist beides.

So liest man das

  • Eckige Klammern [ ] markieren einen Teil, den man weglassen kann.
  • Drei Punkte … heißen: mehrere sind erlaubt.
  • Optionen achten auf Groß- und Kleinschreibung — bei manchen Befehlen sind -r und -R verschieden.

Häufige Fragen

Q. Was macht dd?

Kopiert Block für Block — so schreibt man ein Installationsabbild auf ein Gerät; was in `of=` steht, wird ohne Rückfrage ab Block null überschrieben, und es gibt kein Zurück, also prüfen Sie das Gerät unmittelbar vor dem Enter noch einmal mit lsblk, nehmen `bs=4M` für Tempo und `status=progress` (unter macOS Ctrl+T) zum Mitschauen.

Q. Wie gibt man ihn ein?

dd if=<source> of=<target> bs=4M status=progress — eckige Klammern markieren, was wegfallen darf.

Q. Wie viele Optionen lohnen sich?

Hier stehen 7; die vollständige Liste steht in man dd. Der Befehl gehört zu Archive.

Verwandte Befehle

man-Seite: man dd