diff options
author | johannst <johannst@users.noreply.github.com> | 2024-01-17 23:37:49 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2024-01-17 23:37:49 +0000 |
commit | c4fdf1c5f2c9ebedd0dedba4449c015f98aecda5 (patch) | |
tree | 74a9ad12c4ff2ae5f382586297a0725a4e6df950 /print.html | |
parent | 3c051e70e5cfe32a0f2379c7a23320a9be88a0d2 (diff) | |
download | notes-c4fdf1c5f2c9ebedd0dedba4449c015f98aecda5.tar.gz notes-c4fdf1c5f2c9ebedd0dedba4449c015f98aecda5.zip |
deploy: 7199cf6515f9545f345b37a402293fc13bbb5a47
Diffstat (limited to 'print.html')
-rw-r--r-- | print.html | 197 |
1 files changed, 186 insertions, 11 deletions
@@ -89,7 +89,7 @@ <nav id="sidebar" class="sidebar" aria-label="Table of contents"> <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><a href="intro.html">Introduction</a></li><li class="chapter-item expanded "><a href="tools/index.html"><strong aria-hidden="true">1.</strong> Tools</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="tools/zsh.html"><strong aria-hidden="true">1.1.</strong> zsh</a></li><li class="chapter-item expanded "><a href="tools/bash.html"><strong aria-hidden="true">1.2.</strong> bash</a></li><li class="chapter-item expanded "><a href="tools/fish.html"><strong aria-hidden="true">1.3.</strong> fish</a></li><li class="chapter-item expanded "><a href="tools/tmux.html"><strong aria-hidden="true">1.4.</strong> tmux</a></li><li class="chapter-item expanded "><a href="tools/git.html"><strong aria-hidden="true">1.5.</strong> git</a></li><li class="chapter-item expanded "><a href="tools/awk.html"><strong aria-hidden="true">1.6.</strong> awk</a></li><li class="chapter-item expanded "><a href="tools/emacs.html"><strong aria-hidden="true">1.7.</strong> emacs</a></li><li class="chapter-item expanded "><a href="tools/gpg.html"><strong aria-hidden="true">1.8.</strong> gpg</a></li><li class="chapter-item expanded "><a href="tools/gdb.html"><strong aria-hidden="true">1.9.</strong> gdb</a></li><li class="chapter-item expanded "><a href="tools/gdbserver.html"><strong aria-hidden="true">1.10.</strong> gdbserver</a></li><li class="chapter-item expanded "><a href="tools/radare2.html"><strong aria-hidden="true">1.11.</strong> radare2</a></li><li class="chapter-item expanded "><a href="tools/qemu.html"><strong aria-hidden="true">1.12.</strong> qemu</a></li><li class="chapter-item expanded "><a href="tools/pacman.html"><strong aria-hidden="true">1.13.</strong> pacman</a></li><li class="chapter-item expanded "><a href="tools/dot.html"><strong aria-hidden="true">1.14.</strong> dot</a></li><li class="chapter-item expanded "><a href="tools/ffmpeg.html"><strong aria-hidden="true">1.15.</strong> ffmpeg</a></li></ol></li><li class="chapter-item expanded "><a href="monitor/index.html"><strong aria-hidden="true">2.</strong> Resource analysis & monitor</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="monitor/lsof.html"><strong aria-hidden="true">2.1.</strong> lsof</a></li><li class="chapter-item expanded "><a href="monitor/ss.html"><strong aria-hidden="true">2.2.</strong> ss</a></li><li class="chapter-item expanded "><a href="monitor/pidstat.html"><strong aria-hidden="true">2.3.</strong> pidstat</a></li><li class="chapter-item expanded "><a href="monitor/pgrep.html"><strong aria-hidden="true">2.4.</strong> pgrep</a></li><li class="chapter-item expanded "><a href="monitor/pmap.html"><strong aria-hidden="true">2.5.</strong> pmap</a></li><li class="chapter-item expanded "><a href="monitor/pstack.html"><strong aria-hidden="true">2.6.</strong> pstack</a></li></ol></li><li class="chapter-item expanded "><a href="trace_profile/index.html"><strong aria-hidden="true">3.</strong> Trace and Profile</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="trace_profile/strace.html"><strong aria-hidden="true">3.1.</strong> strace</a></li><li class="chapter-item expanded "><a href="trace_profile/ltrace.html"><strong aria-hidden="true">3.2.</strong> ltrace</a></li><li class="chapter-item expanded "><a href="trace_profile/perf.html"><strong aria-hidden="true">3.3.</strong> perf</a></li><li class="chapter-item expanded "><a href="trace_profile/oprofile.html"><strong aria-hidden="true">3.4.</strong> OProfile</a></li><li class="chapter-item expanded "><a href="trace_profile/time.html"><strong aria-hidden="true">3.5.</strong> time</a></li></ol></li><li class="chapter-item expanded "><a href="binary/index.html"><strong aria-hidden="true">4.</strong> Binary</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="binary/od.html"><strong aria-hidden="true">4.1.</strong> od</a></li><li class="chapter-item expanded "><a href="binary/xxd.html"><strong aria-hidden="true">4.2.</strong> xxd</a></li><li class="chapter-item expanded "><a href="binary/readelf.html"><strong aria-hidden="true">4.3.</strong> readelf</a></li><li class="chapter-item expanded "><a href="binary/objdump.html"><strong aria-hidden="true">4.4.</strong> objdump</a></li><li class="chapter-item expanded "><a href="binary/nm.html"><strong aria-hidden="true">4.5.</strong> nm</a></li></ol></li><li class="chapter-item expanded "><a href="development/index.html"><strong aria-hidden="true">5.</strong> Development</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/c++filt.html"><strong aria-hidden="true">5.1.</strong> c++filt</a></li><li class="chapter-item expanded "><a href="development/c++.html"><strong aria-hidden="true">5.2.</strong> c++</a></li><li class="chapter-item expanded "><a href="development/glibc.html"><strong aria-hidden="true">5.3.</strong> glibc</a></li><li class="chapter-item expanded "><a href="development/gcc.html"><strong aria-hidden="true">5.4.</strong> gcc</a></li><li class="chapter-item expanded "><a href="development/cmake.html"><strong aria-hidden="true">5.5.</strong> cmake</a></li><li class="chapter-item expanded "><a href="development/make.html"><strong aria-hidden="true">5.6.</strong> make</a></li><li class="chapter-item expanded "><a href="development/ld.so.html"><strong aria-hidden="true">5.7.</strong> ld.so</a></li><li class="chapter-item expanded "><a href="development/symbolver.html"><strong aria-hidden="true">5.8.</strong> symbol versioning</a></li><li class="chapter-item expanded "><a href="development/python.html"><strong aria-hidden="true">5.9.</strong> python</a></li><li class="chapter-item expanded "><a href="development/gcov.html"><strong aria-hidden="true">5.10.</strong> gcov</a></li><li class="chapter-item expanded "><a href="development/pgo.html"><strong aria-hidden="true">5.11.</strong> pgo</a></li></ol></li><li class="chapter-item expanded "><a href="linux/index.html"><strong aria-hidden="true">6.</strong> Linux</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="linux/systemd.html"><strong aria-hidden="true">6.1.</strong> systemd</a></li><li class="chapter-item expanded "><a href="linux/coredump.html"><strong aria-hidden="true">6.2.</strong> coredump</a></li><li class="chapter-item expanded "><a href="linux/ptrace_scope.html"><strong aria-hidden="true">6.3.</strong> ptrace_scope</a></li><li class="chapter-item expanded "><a href="linux/cryptsetup.html"><strong aria-hidden="true">6.4.</strong> cryptsetup</a></li><li class="chapter-item expanded "><a href="linux/swap.html"><strong aria-hidden="true">6.5.</strong> swap</a></li><li class="chapter-item expanded "><a href="linux/input.html"><strong aria-hidden="true">6.6.</strong> input</a></li><li class="chapter-item expanded "><a href="linux/acl.html"><strong aria-hidden="true">6.7.</strong> acl</a></li><li class="chapter-item expanded "><a href="linux/zfs.html"><strong aria-hidden="true">6.8.</strong> zfs</a></li></ol></li><li class="chapter-item expanded "><a href="network/index.html"><strong aria-hidden="true">7.</strong> Network</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="network/tcpdump.html"><strong aria-hidden="true">7.1.</strong> tcpdump</a></li><li class="chapter-item expanded "><a href="network/tshark.html"><strong aria-hidden="true">7.2.</strong> tshark</a></li><li class="chapter-item expanded "><a href="network/firewall-cmd.html"><strong aria-hidden="true">7.3.</strong> firewall-cmd</a></li><li class="chapter-item expanded "><a href="network/nftables.html"><strong aria-hidden="true">7.4.</strong> nftables</a></li></ol></li><li class="chapter-item expanded "><a href="web/index.html"><strong aria-hidden="true">8.</strong> Web</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="web/html.html"><strong aria-hidden="true">8.1.</strong> html</a></li><li class="chapter-item expanded "><a href="web/css.html"><strong aria-hidden="true">8.2.</strong> css</a></li><li class="chapter-item expanded "><a href="web/chartjs.html"><strong aria-hidden="true">8.3.</strong> chartjs</a></li></ol></li><li class="chapter-item expanded "><a href="arch/index.html"><strong aria-hidden="true">9.</strong> Arch</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="arch/x86_64.html"><strong aria-hidden="true">9.1.</strong> x86_64</a></li><li class="chapter-item expanded "><a href="arch/arm64.html"><strong aria-hidden="true">9.2.</strong> arm64</a></li><li class="chapter-item expanded "><a href="arch/armv7.html"><strong aria-hidden="true">9.3.</strong> armv7</a></li><li class="chapter-item expanded "><a href="arch/riscv.html"><strong aria-hidden="true">9.4.</strong> riscv</a></li></ol></li></ol> + <ol class="chapter"><li class="chapter-item expanded affix "><a href="intro.html">Introduction</a></li><li class="chapter-item expanded "><a href="tools/index.html"><strong aria-hidden="true">1.</strong> Tools</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="tools/zsh.html"><strong aria-hidden="true">1.1.</strong> zsh</a></li><li class="chapter-item expanded "><a href="tools/bash.html"><strong aria-hidden="true">1.2.</strong> bash</a></li><li class="chapter-item expanded "><a href="tools/fish.html"><strong aria-hidden="true">1.3.</strong> fish</a></li><li class="chapter-item expanded "><a href="tools/tmux.html"><strong aria-hidden="true">1.4.</strong> tmux</a></li><li class="chapter-item expanded "><a href="tools/git.html"><strong aria-hidden="true">1.5.</strong> git</a></li><li class="chapter-item expanded "><a href="tools/awk.html"><strong aria-hidden="true">1.6.</strong> awk</a></li><li class="chapter-item expanded "><a href="tools/emacs.html"><strong aria-hidden="true">1.7.</strong> emacs</a></li><li class="chapter-item expanded "><a href="tools/gpg.html"><strong aria-hidden="true">1.8.</strong> gpg</a></li><li class="chapter-item expanded "><a href="tools/gdb.html"><strong aria-hidden="true">1.9.</strong> gdb</a></li><li class="chapter-item expanded "><a href="tools/gdbserver.html"><strong aria-hidden="true">1.10.</strong> gdbserver</a></li><li class="chapter-item expanded "><a href="tools/radare2.html"><strong aria-hidden="true">1.11.</strong> radare2</a></li><li class="chapter-item expanded "><a href="tools/qemu.html"><strong aria-hidden="true">1.12.</strong> qemu</a></li><li class="chapter-item expanded "><a href="tools/pacman.html"><strong aria-hidden="true">1.13.</strong> pacman</a></li><li class="chapter-item expanded "><a href="tools/dot.html"><strong aria-hidden="true">1.14.</strong> dot</a></li><li class="chapter-item expanded "><a href="tools/ffmpeg.html"><strong aria-hidden="true">1.15.</strong> ffmpeg</a></li><li class="chapter-item expanded "><a href="tools/column.html"><strong aria-hidden="true">1.16.</strong> column</a></li><li class="chapter-item expanded "><a href="tools/sort.html"><strong aria-hidden="true">1.17.</strong> sort</a></li><li class="chapter-item expanded "><a href="tools/sed.html"><strong aria-hidden="true">1.18.</strong> sed</a></li></ol></li><li class="chapter-item expanded "><a href="monitor/index.html"><strong aria-hidden="true">2.</strong> Resource analysis & monitor</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="monitor/lsof.html"><strong aria-hidden="true">2.1.</strong> lsof</a></li><li class="chapter-item expanded "><a href="monitor/ss.html"><strong aria-hidden="true">2.2.</strong> ss</a></li><li class="chapter-item expanded "><a href="monitor/pidstat.html"><strong aria-hidden="true">2.3.</strong> pidstat</a></li><li class="chapter-item expanded "><a href="monitor/pgrep.html"><strong aria-hidden="true">2.4.</strong> pgrep</a></li><li class="chapter-item expanded "><a href="monitor/pmap.html"><strong aria-hidden="true">2.5.</strong> pmap</a></li><li class="chapter-item expanded "><a href="monitor/pstack.html"><strong aria-hidden="true">2.6.</strong> pstack</a></li></ol></li><li class="chapter-item expanded "><a href="trace_profile/index.html"><strong aria-hidden="true">3.</strong> Trace and Profile</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="trace_profile/strace.html"><strong aria-hidden="true">3.1.</strong> strace</a></li><li class="chapter-item expanded "><a href="trace_profile/ltrace.html"><strong aria-hidden="true">3.2.</strong> ltrace</a></li><li class="chapter-item expanded "><a href="trace_profile/perf.html"><strong aria-hidden="true">3.3.</strong> perf</a></li><li class="chapter-item expanded "><a href="trace_profile/oprofile.html"><strong aria-hidden="true">3.4.</strong> OProfile</a></li><li class="chapter-item expanded "><a href="trace_profile/time.html"><strong aria-hidden="true">3.5.</strong> time</a></li></ol></li><li class="chapter-item expanded "><a href="binary/index.html"><strong aria-hidden="true">4.</strong> Binary</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="binary/od.html"><strong aria-hidden="true">4.1.</strong> od</a></li><li class="chapter-item expanded "><a href="binary/xxd.html"><strong aria-hidden="true">4.2.</strong> xxd</a></li><li class="chapter-item expanded "><a href="binary/readelf.html"><strong aria-hidden="true">4.3.</strong> readelf</a></li><li class="chapter-item expanded "><a href="binary/objdump.html"><strong aria-hidden="true">4.4.</strong> objdump</a></li><li class="chapter-item expanded "><a href="binary/nm.html"><strong aria-hidden="true">4.5.</strong> nm</a></li></ol></li><li class="chapter-item expanded "><a href="development/index.html"><strong aria-hidden="true">5.</strong> Development</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/c++filt.html"><strong aria-hidden="true">5.1.</strong> c++filt</a></li><li class="chapter-item expanded "><a href="development/c++.html"><strong aria-hidden="true">5.2.</strong> c++</a></li><li class="chapter-item expanded "><a href="development/glibc.html"><strong aria-hidden="true">5.3.</strong> glibc</a></li><li class="chapter-item expanded "><a href="development/gcc.html"><strong aria-hidden="true">5.4.</strong> gcc</a></li><li class="chapter-item expanded "><a href="development/cmake.html"><strong aria-hidden="true">5.5.</strong> cmake</a></li><li class="chapter-item expanded "><a href="development/make.html"><strong aria-hidden="true">5.6.</strong> make</a></li><li class="chapter-item expanded "><a href="development/ld.so.html"><strong aria-hidden="true">5.7.</strong> ld.so</a></li><li class="chapter-item expanded "><a href="development/symbolver.html"><strong aria-hidden="true">5.8.</strong> symbol versioning</a></li><li class="chapter-item expanded "><a href="development/python.html"><strong aria-hidden="true">5.9.</strong> python</a></li><li class="chapter-item expanded "><a href="development/gcov.html"><strong aria-hidden="true">5.10.</strong> gcov</a></li><li class="chapter-item expanded "><a href="development/pgo.html"><strong aria-hidden="true">5.11.</strong> pgo</a></li></ol></li><li class="chapter-item expanded "><a href="linux/index.html"><strong aria-hidden="true">6.</strong> Linux</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="linux/systemd.html"><strong aria-hidden="true">6.1.</strong> systemd</a></li><li class="chapter-item expanded "><a href="linux/coredump.html"><strong aria-hidden="true">6.2.</strong> coredump</a></li><li class="chapter-item expanded "><a href="linux/ptrace_scope.html"><strong aria-hidden="true">6.3.</strong> ptrace_scope</a></li><li class="chapter-item expanded "><a href="linux/cryptsetup.html"><strong aria-hidden="true">6.4.</strong> cryptsetup</a></li><li class="chapter-item expanded "><a href="linux/swap.html"><strong aria-hidden="true">6.5.</strong> swap</a></li><li class="chapter-item expanded "><a href="linux/input.html"><strong aria-hidden="true">6.6.</strong> input</a></li><li class="chapter-item expanded "><a href="linux/acl.html"><strong aria-hidden="true">6.7.</strong> acl</a></li><li class="chapter-item expanded "><a href="linux/zfs.html"><strong aria-hidden="true">6.8.</strong> zfs</a></li></ol></li><li class="chapter-item expanded "><a href="network/index.html"><strong aria-hidden="true">7.</strong> Network</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="network/tcpdump.html"><strong aria-hidden="true">7.1.</strong> tcpdump</a></li><li class="chapter-item expanded "><a href="network/tshark.html"><strong aria-hidden="true">7.2.</strong> tshark</a></li><li class="chapter-item expanded "><a href="network/firewall-cmd.html"><strong aria-hidden="true">7.3.</strong> firewall-cmd</a></li><li class="chapter-item expanded "><a href="network/nftables.html"><strong aria-hidden="true">7.4.</strong> nftables</a></li></ol></li><li class="chapter-item expanded "><a href="web/index.html"><strong aria-hidden="true">8.</strong> Web</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="web/html.html"><strong aria-hidden="true">8.1.</strong> html</a></li><li class="chapter-item expanded "><a href="web/css.html"><strong aria-hidden="true">8.2.</strong> css</a></li><li class="chapter-item expanded "><a href="web/chartjs.html"><strong aria-hidden="true">8.3.</strong> chartjs</a></li></ol></li><li class="chapter-item expanded "><a href="arch/index.html"><strong aria-hidden="true">9.</strong> Arch</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="arch/x86_64.html"><strong aria-hidden="true">9.1.</strong> x86_64</a></li><li class="chapter-item expanded "><a href="arch/arm64.html"><strong aria-hidden="true">9.2.</strong> arm64</a></li><li class="chapter-item expanded "><a href="arch/armv7.html"><strong aria-hidden="true">9.3.</strong> armv7</a></li><li class="chapter-item expanded "><a href="arch/riscv.html"><strong aria-hidden="true">9.4.</strong> riscv</a></li></ol></li></ol> </div> <div id="sidebar-resize-handle" class="sidebar-resize-handle"> <div class="sidebar-resize-indicator"></div> @@ -197,6 +197,9 @@ <li><a href="tools/./pacman.html">pacman</a></li> <li><a href="tools/./dot.html">dot</a></li> <li><a href="tools/./ffmpeg.html">ffmpeg</a></li> +<li><a href="tools/./column.html">column</a></li> +<li><a href="tools/./sort.html">sort</a></li> +<li><a href="tools/./sed.html">sed</a></li> </ul> <div style="break-before: page; page-break-before: always;"></div><h1 id="zsh1"><a class="header" href="#zsh1">zsh(1)</a></h1> <h2 id="keybindings"><a class="header" href="#keybindings">Keybindings</a></h2> @@ -1071,6 +1074,7 @@ list-keys -t vi-copy list keymaps for vi-copy mode git branch -d <bname> .......... delete local branch with name <bname> git checkout <bname> ........... switch to branch with name <bname> git checkout --track <branch> .. start to locally track a remote branch + git branch --unset-upstream .... unset remote tracking branch # Remote @@ -1091,6 +1095,16 @@ list-keys -t vi-copy list keymaps for vi-copy mode git push origin --tags .... push local tags to origin (or other remote) </code></pre> +<h2 id="worktree"><a class="header" href="#worktree">Worktree</a></h2> +<p>Worktrees allow to maintain multiple working trees in the filesystem linked to +the same repository (shared .git folder).</p> +<pre><code class="language-markdown"> git worktree add <path> .............. create a tree at <path> with a new branch + checked out (bname is basename of <path>) + git worktree add <path> <bname> ...... create a tree at <path> from existing <bname> + git worktree list .................... list existing work trees + git worktree remove <tree> ........... remove work tree + git worktree prune ................... remove stale bookkeeping files +</code></pre> <h2 id="log--commit-history"><a class="header" href="#log--commit-history">Log & Commit History</a></h2> <pre><code class="language-markdown"> git log --oneline ......... shows log in single line per commit -> alias for '--pretty=oneline --abbrev-commit' @@ -2490,6 +2504,103 @@ ffmpeg -framerate 25 -f x11grab $video_args -pix_fmt yuv420p $@ output.mp4 <p>The input <code>-i 0,0+xoff,yoff</code> means to capture <code>$DISPLAY=0.0</code> starting at the coordinate <code>(xoff, yoff)</code>, which is the left-upper corner, and the size of the capture is defined by the <code>-video_size</code> argument.</p> +<div style="break-before: page; page-break-before: always;"></div><h1 id="column1"><a class="header" href="#column1">column(1)</a></h1> +<h2 id="examples-4"><a class="header" href="#examples-4">Examples</a></h2> +<pre><code class="language-sh"># Show as table (aligned columns), with comma as delimiter from stdin. +echo -e 'a,b,c\n111,22222,33' | column -t -s ',' + +# Show file as table. +column -t -s ',' test.csv +</code></pre> +<div style="break-before: page; page-break-before: always;"></div><h1 id="sort1"><a class="header" href="#sort1">sort(1)</a></h1> +<pre><code>sort [opts] [file] + opts: + -r reverse output + -b ignore leading blanks + + -n sort by numeric + -h sort by human numeric + -V sort by version + + -k<N> sort by Nth key + -t<S> field separator +</code></pre> +<h2 id="examples-5"><a class="header" href="#examples-5">Examples</a></h2> +<pre><code class="language-sh"># Sort by directory sizes. +du -sh * | sort -h +</code></pre> +<pre><code class="language-sh"># Sort numeric by second key. +# The default key separator is non-blank to blank transition. +echo 'a 4 +d 10 +c 21' | sort -k2 -n + +# Sort numeric by second key, split at comma. +echo 'a,4 +d,10 +c,21' | sort -k2 -n -t, +</code></pre> +<blockquote> +<p>Use <code>--debug</code> to annotate part of the line used to sort and hence debug the key usage.</p> +</blockquote> +<div style="break-before: page; page-break-before: always;"></div><h1 id="sed1"><a class="header" href="#sed1">sed(1)</a></h1> +<pre><code>sed [opts] [script] [file] + opts: + -i edit file in place + -i.bk edit file in place and create backup file + (with .bk suffix, can be specified differently) + -e SCRIPT add SCRIPT to commands to be executed + (can be specified multiple times) + -f FILE add content of FILE to command to be executed + + --debug annotate program execution +</code></pre> +<h2 id="examples-6"><a class="header" href="#examples-6">Examples</a></h2> +<h3 id="delete-lines"><a class="header" href="#delete-lines">Delete lines</a></h3> +<pre><code class="language-sh"># Delete two lines. +echo -e 'aa\nbb\ncc\ndd' | sed '1d;3d' +# bb +# dd + +# Delete last ($) line. +echo -e 'aa\nbb\ncc\ndd' | sed '$d' +# aa +# bb +# cc + +# Delete range of lines. +echo -e 'aa\nbb\ncc\ndd' | sed '1,3d' +# dd +</code></pre> +<h3 id="insert-lines"><a class="header" href="#insert-lines">Insert lines</a></h3> +<pre><code class="language-sh"># Insert before line. +echo -e 'aa\nbb' | sed '2iABC' +# aa +# ABC +# bb + +# Insert after line. +echo -e 'aa\nbb' | sed '2aABC' +# aa +# bb +# ABC + +# Replace line. +echo -e 'aa\nbb' | sed '2cABC' +# aa +# ABC +</code></pre> +<h3 id="substitute-lines"><a class="header" href="#substitute-lines">Substitute lines</a></h3> +<pre><code class="language-sh"># Substitute by regex. +echo -e 'aafooaa\ncc' | sed 's/foo/MOOSE/' +# aaMOOSEaa +# cc +</code></pre> +<h3 id="multiple-scripts"><a class="header" href="#multiple-scripts">Multiple scripts</a></h3> +<pre><code class="language-sh">echo -e 'foo\nbar' | sed -e 's/foo/FOO/' -e 's/FOO/BAR/' +# BAR +# bar +</code></pre> <div style="break-before: page; page-break-before: always;"></div><h1 id="resource-analysis--monitor"><a class="header" href="#resource-analysis--monitor">Resource analysis & monitor</a></h1> <ul> <li><a href="monitor/./lsof.html">lsof</a></li> @@ -2527,7 +2638,7 @@ capture is defined by the <code>-video_size</code> argument.</p> -s states (UDP) Unbound, Idle </code></pre> -<h1 id="examples-4"><a class="header" href="#examples-4">Examples</a></h1> +<h1 id="examples-7"><a class="header" href="#examples-7">Examples</a></h1> <h2 id="file-flags"><a class="header" href="#file-flags">File flags</a></h2> <p>Show open files with file flags for process:</p> <pre><code class="language-markdown">lsof +fg -p <pid> @@ -2575,7 +2686,7 @@ lsof /proc (EXPR) .............. Group exprs </code></pre> -<h1 id="examples-5"><a class="header" href="#examples-5">Examples</a></h1> +<h1 id="examples-8"><a class="header" href="#examples-8">Examples</a></h1> <p>Show all tcp IPv4 sockets connecting to port <code>443</code>:</p> <pre><code class="language-markdown">ss -4 'dport 443' </code></pre> @@ -2665,7 +2776,7 @@ opts: trace=signal ............... trace signal related syscalls signal ..................... trace signals delivered to the process </code></pre> -<h1 id="examples-6"><a class="header" href="#examples-6">Examples</a></h1> +<h1 id="examples-9"><a class="header" href="#examples-9">Examples</a></h1> <p>Trace <code>open(2)</code> & <code>socket(2)</code> syscalls for a running process + child processes:</p> <pre><code class="language-markdown">strace -f -e trace=open,socket -p <pid> </code></pre> @@ -5314,7 +5425,7 @@ tcp/udp/icmp Filter for protocol. <blockquote> <p>Use <code>and/or/not</code> and <code>()</code> to build filter expressions.</p> </blockquote> -<h1 id="examples-7"><a class="header" href="#examples-7">Examples</a></h1> +<h1 id="examples-10"><a class="header" href="#examples-10">Examples</a></h1> <h2 id="capture-packets-from-remote-host"><a class="header" href="#capture-packets-from-remote-host">Capture packets from remote host</a></h2> <pre><code class="language-makrdown"># -k: Start capturing immediately. ssh <host> tcpdump -i any -w - | sudo wireshark -k -i - @@ -5346,7 +5457,7 @@ tcp/udp/ssh/wg/... Filter for protocol. <blockquote> <p>Use <code>tshak -G</code> to list all fields that can be used in display filters.</p> </blockquote> -<h1 id="examples-8"><a class="header" href="#examples-8">Examples</a></h1> +<h1 id="examples-11"><a class="header" href="#examples-11">Examples</a></h1> <h2 id="capture-and-filter-packet-to-file"><a class="header" href="#capture-and-filter-packet-to-file">Capture and filter packet to file</a></h2> <pre><code class="language-bash"># Capture TCP traffic with port 80 on interface eth0 to file. sudo tshark -i eht0 -f 'tcp and port 80' -w tx.pcap @@ -5926,7 +6037,7 @@ rax 64 bit rax+rdx 128 bit </code></pre> </li> -<li>Floating point return values: +<li>Floating point return values <pre><code class="language-markdown">reg size ------------------- xmm0 64 bit @@ -5987,6 +6098,70 @@ pop rbp // restore caller base pointer </blockquote> </li> </ul> +<h2 id="windows-x64-abi"><a class="header" href="#windows-x64-abi"><a href="https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions">Windows x64 ABI</a></a></h2> +<h3 id="passing-arguments-to-functions-ref"><a class="header" href="#passing-arguments-to-functions-ref">Passing arguments to functions (<a href="https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention">ref</a>)</a></h3> +<blockquote> +<p>A single argument is never spread across multiple registers.</p> +</blockquote> +<ul> +<li>Integer/Pointer arguments +<pre><code class="language-markdown">reg arg +----------- +rcx 1 +rdx 2 +r8 3 +r9 4 +</code></pre> +</li> +<li>Floating point arguments +<pre><code class="language-markdown">reg arg +----------- +xmm0 1 + .. .. +xmm3 4 +</code></pre> +</li> +<li>Additional arguments are passed on the stack. Arguments are pushed +right-to-left (RTL), meaning next arguments are closer to current <code>rsp</code>. +<a href="https://godbolt.org/z/oT5Tjdf7Y">See example</a>.</li> +</ul> +<h3 id="return-values-from-functions-1"><a class="header" href="#return-values-from-functions-1">Return values from functions</a></h3> +<ul> +<li>Integer/Pointer return values +<pre><code class="language-markdown">reg size +----------------- +rax 64 bit +</code></pre> +</li> +<li>Floating point return values +<pre><code class="language-markdown">reg size +------------------- +xmm0 64 bit +</code></pre> +</li> +</ul> +<h3 id="caller-saved-registers-1"><a class="header" href="#caller-saved-registers-1">Caller saved registers</a></h3> +<p>Caller must save these registers if they should be preserved across function +calls.</p> +<ul> +<li><code>rax</code></li> +<li><code>rcx</code></li> +<li><code>rdx</code></li> +<li><code>r8</code> - <code>r11</code></li> +<li><code>xmm0</code> - <code>xmm5</code></li> +</ul> +<h3 id="callee-saved-registers-1"><a class="header" href="#callee-saved-registers-1">Callee saved registers</a></h3> +<p>Caller can expect these registers to be preserved across function calls. Callee +must must save these registers in case they are used.</p> +<ul> +<li><code>rbx</code></li> +<li><code>rbp</code></li> +<li><code>rdi</code></li> +<li><code>rsi</code></li> +<li><code>rsp</code></li> +<li><code>r12</code> - <code>r15</code></li> +<li><code>xmm6</code> - <code>xmm15</code></li> +</ul> <h2 id="asm-skeleton"><a class="header" href="#asm-skeleton">ASM skeleton</a></h2> <p>Small assembler skeleton, ready to use with following properties:</p> <ul> @@ -6140,7 +6315,7 @@ x7 8 </code></pre> </li> </ul> -<h3 id="return-values-from-functions-1"><a class="header" href="#return-values-from-functions-1">Return values from functions</a></h3> +<h3 id="return-values-from-functions-2"><a class="header" href="#return-values-from-functions-2">Return values from functions</a></h3> <ul> <li>Integer/Pointer return values <pre><code class="language-markdown">reg size @@ -6149,7 +6324,7 @@ x0 64 bit </code></pre> </li> </ul> -<h3 id="callee-saved-registers-1"><a class="header" href="#callee-saved-registers-1">Callee saved registers</a></h3> +<h3 id="callee-saved-registers-2"><a class="header" href="#callee-saved-registers-2">Callee saved registers</a></h3> <ul> <li><code>x19</code> - <code>x28</code></li> <li><code>SP</code></li> @@ -6372,7 +6547,7 @@ r3 4 </code></pre> </li> </ul> -<h3 id="return-values-from-functions-2"><a class="header" href="#return-values-from-functions-2">Return values from functions</a></h3> +<h3 id="return-values-from-functions-3"><a class="header" href="#return-values-from-functions-3">Return values from functions</a></h3> <ul> <li>integer/pointer return values <pre><code class="language-markdown">reg size @@ -6382,7 +6557,7 @@ r0+r1 64 bit </code></pre> </li> </ul> -<h3 id="callee-saved-registers-2"><a class="header" href="#callee-saved-registers-2">Callee saved registers</a></h3> +<h3 id="callee-saved-registers-3"><a class="header" href="#callee-saved-registers-3">Callee saved registers</a></h3> <ul> <li><code>r4</code> - <code>r11</code></li> <li><code>sp</code></li> |