3 ms·
This. The alternative: sudo sh -c 'cat some.img > /dev/sdb' or even more baroque: cat some.img | sudo tee /dev/sdb > /dev/null is a pain by compari
by thom_nic 10y ago
This. The alternative:
sudo sh -c 'cat some.img > /dev/sdb'
or even more baroque:
cat some.img | sudo tee /dev/sdb > /dev/null
is a pain by comparison, and the `sudo sh -c` variant has env implications when spawning a sub-shell.
I have an ARM/linux installer script that writes the u-boot image to a specific offset before the first partition:
dd if=${UBOOT_DIR}/MLO of=$LO_DEVICE count=1 seek=1 bs=128k
dd if=${UBOOT_DIR}/u-boot.img of=$LO_DEVICE count=2 seek=1 bs=384k
This is admittedly somewhat esoteric, but it seems like a stretch to say `dd` does not have some place, especially when transferring binary data in very specific ways.
- majewsky 10y agoSince we're sharing shell tricks: The "sudo tee > /dev/null" may be baroque, but I find it useful whenever I start editing stuff in /etc in vim, only to find that I cannot write my changes because I'm not root. In that case, :w !sudo tee % does the trick. (What "w!" does is send the buffer into the given shell command as stdin.)