cheatsheet.zwischenspeicher.info

Some tech documentation and snippets, finally organized.

Piping dd

Write to several devices at once with dd and tee:

$ dd if=INFILE | tee > (dd of=/dev/sdX) | dd of=/dev/sdY

dd over the network with netcat and bzip compression (not encrypted),
serverside...

$ nc -l 9000 | bzip2 -d | dd bs=1M of=OUTFILE

...and clientside:

$ dd bs=1M if=INFILE | bzip2 -c | nc SERVER 9000

Writing data to an ssh server, using xz transport compression:

$ dd if=INFILE bs= 1M | xz |\
    ssh user@host "xz -d | dd of=OUTFILE bs=1M"

Reading data from an ssh server, again with xz transport compression:

$ ssh user@host "dd if=INFILE bs=1M | xz" |\
    xz -d | dd of=OUTFILE bs=1M