aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-13 21:31:18 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-13 21:31:18 +0200
commit66c7f4cb944aea255f52fcb598c876b951879154 (patch)
tree9cd12ee684b92a9e0a267607c4d14b99d2775230
parent5742a07bd78e0b815fe6f04eb48e47152e842a7b (diff)
downloadnotes-66c7f4cb944aea255f52fcb598c876b951879154.tar.gz
notes-66c7f4cb944aea255f52fcb598c876b951879154.zip
dd: initial notes
-rw-r--r--src/SUMMARY.md1
-rw-r--r--src/cli/README.md1
-rw-r--r--src/cli/dd.md46
3 files changed, 48 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index ac41b1a..5af20c9 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -20,6 +20,7 @@
- [xargs](./cli/xargs.md)
- [grep](./cli/grep.md)
- [find](./cli/find.md)
+ - [dd](./cli/dd.md)
- [Tools](./tools/README.md)
- [tmux](./tools/tmux.md)
diff --git a/src/cli/README.md b/src/cli/README.md
index ffde988..2a115e3 100644
--- a/src/cli/README.md
+++ b/src/cli/README.md
@@ -12,3 +12,4 @@
- [xargs](./xargs.md)
- [grep](./grep.md)
- [find](./find.md)
+- [dd](./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=<path> input file to read (stdin in case not specified)
+ of=<path> oputput file to write
+ status=progress show progress while copying
+ bs=<bytes> block size
+ count=<n> copy only <n> blocks
+ skip=<n> skip <n> blocks in input (seek input)
+ seek=<n> skip <n> blocks in oputput (seek output)
+ conv=<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=<iso> of=<blkdev> 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
+```