From 66c7f4cb944aea255f52fcb598c876b951879154 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 13 Apr 2025 21:31:18 +0200 Subject: dd: initial notes --- src/cli/dd.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/cli/dd.md (limited to 'src/cli/dd.md') diff --git a/src/cli/dd.md b/src/cli/dd.md new file mode 100644 index 0000000..709cfa0 --- /dev/null +++ b/src/cli/dd.md @@ -0,0 +1,46 @@ +# dd(1) + +Copy data `block-wise`. + +``` +dd [opts] + if= input file to read (stdin in case not specified) + of= oputput file to write + status=progress show progress while copying + bs= block size + count= copy only blocks + skip= skip blocks in input (seek input) + seek= skip blocks in oputput (seek output) + conv= + notrunc dont truncate output file + excl fail if output already exists + nocreat fail if output does not exists +``` + +## Example: bootstick + +```bash +dd bs=4M if= of= oflag=sync status=progress +``` + +## Example: patch file in place + +```bash +# Create a 1024 bytes file filled with zeros. +dd if=/dev/zero of=disk bs=512 count=2 + +# Overwrite 4 bytes starting at byte 0. +printf "aaaa" | dd of=disk bs=1 seek=0 conv=notrunc + +# Overwrite 4 bytes starting at byte 512. +printf "bbbb" | dd of=disk bs=1 seek=512 conv=notrunc + +hexdump disk +# 0000000 6161 6161 0000 0000 0000 0000 0000 0000 +# 0000010 0000 0000 0000 0000 0000 0000 0000 0000 +# * +# 0000200 6262 6262 0000 0000 0000 0000 0000 0000 +# 0000210 0000 0000 0000 0000 0000 0000 0000 0000 +# * +# 0000400 +``` -- cgit v1.2.3