diff options
author | johannst <johannst@users.noreply.github.com> | 2025-04-13 19:34:18 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2025-04-13 19:34:18 +0000 |
commit | 30106144fe6f065b36faf3833a930f78b828529a (patch) | |
tree | 3aa9fb6bb868538dc77a13baada4500d75987694 /print.html | |
parent | 4a9214d09d6a526bd029a1f92a01a5f451313c9a (diff) | |
download | notes-30106144fe6f065b36faf3833a930f78b828529a.tar.gz notes-30106144fe6f065b36faf3833a930f78b828529a.zip |
deploy: c929dc819132694c50a22eccb5c90b20aa39d97d
Diffstat (limited to 'print.html')
-rw-r--r-- | print.html | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -1004,6 +1004,7 @@ status -f # abs path of current file <li><a href="cli/./xargs.html">xargs</a></li> <li><a href="cli/./grep.html">grep</a></li> <li><a href="cli/./find.html">find</a></li> +<li><a href="cli/./dd.html">dd</a></li> </ul> <div style="break-before: page; page-break-before: always;"></div><h1 id="awk1"><a class="header" href="#awk1">awk(1)</a></h1> <pre><code class="language-markdown">awk [opt] program [input] @@ -1477,6 +1478,43 @@ exec modifier characters <code>;</code> and <code>+</code> also may need to be e > find . -maxdepth 1 -type d -exec echo x {} + # x . ./.github ./book ./src ./.git ./docs </code></pre> +<div style="break-before: page; page-break-before: always;"></div><h1 id="dd1"><a class="header" href="#dd1">dd(1)</a></h1> +<p>Copy data <code>block-wise</code>.</p> +<pre><code>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 +</code></pre> +<h2 id="example-bootstick"><a class="header" href="#example-bootstick">Example: bootstick</a></h2> +<pre><code class="language-bash">dd bs=4M if=<iso> of=<blkdev> oflag=sync status=progress +</code></pre> +<h2 id="example-patch-file-in-place"><a class="header" href="#example-patch-file-in-place">Example: patch file in place</a></h2> +<pre><code class="language-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 +</code></pre> <div style="break-before: page; page-break-before: always;"></div><h1 id="tools"><a class="header" href="#tools">Tools</a></h1> <ul> <li><a href="tools/./tmux.html">tmux</a></li> @@ -2157,6 +2195,10 @@ Ctrl+a c switch between monitor and console # Confifure virtio as 3D video graphic accelerator (requires virgl in guest). -vga virtio + +# Disable graphical output, and redirect serial console to qemu processes stdio +# (-serial stdio). +-nographic </code></pre> <h3 id="boot-menu"><a class="header" href="#boot-menu">Boot Menu</a></h3> <pre><code class="language-bash"># Enables boot menu to select boot device (enter with `ESC`). @@ -4090,6 +4132,11 @@ the <code>.rodata</code> section as follows:</p> >> }; >> unsigned int _proc_self_fd_11_len = 4; </code></pre> +<h2 id="patching-binary-file-by-hand-in-hex-mode"><a class="header" href="#patching-binary-file-by-hand-in-hex-mode">Patching binary file by hand in hex mode</a></h2> +<pre><code class="language-markdown"> xxd /bin/ls > ls.hex + # edit binary file in hex format (ascii) + xxd -r ls.hex > ls +</code></pre> <div style="break-before: page; page-break-before: always;"></div><h1 id="readelf1"><a class="header" href="#readelf1">readelf(1)</a></h1> <pre><code class="language-markdown"> readelf [opts] <elf> -W|--wide wide output, dont break output at 80 chars |