That performance difference often comes from block size; "dd bs=1M" typically runs much faster than the default block size of 512 bytes.
cat foobar.img | sudo tee /dev/sdi > /dev/null
cat foobar.img | sudo tee /dev/sdi >&-
$ sudo tee /dev/sdi >&- < foobar.img
Or better yet, pv[1]; you even get a progress bar that way![0] https://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_...
`od` is ubiquitous--it's POSIX and a requirement of the Single UNIX Specification
sudo (cat foobar.img > /dev/sdi)
Work? sudo sh -c "cat foobar.img > /dev/sdi"
or sudo -s "cat foobar.img > /dev/sdi" sudo sh <<EOF
cat foobar.img > /dev/sdi
EOFIn short, you could do it, but it'd be ripped out of every server that's been hardened, and for users that don't want to care - they're just running 'sudo su' anyhow.
Speaking only for myself, the thought of my shell having a magical escalation process would scare the bejeezus out of me - and I'm supposed to have root on our boxes!
zsh: parse error near `)'
Is it just ignoring the parentheses? Does the redirection "take precedence" over parentheses and brackets?Laptops don't need to follow multiuser best practices, and frankly a complex root password offers little.
sudo (cat foobar.img > /dev/sdi)
No?
I'd wondered whether dd or cat were faster, and indeed cat is faster, but not by much. Also, for some embedded devices, you have to write to specific offsets, so dd is more convenient and explicit. Lastly, cat composes poorly with sudo.
> I only use dd for specific blocks, like writing back a backup of the mbr, or as a rudimentary hex editor.xxd / xxd -r is much nicer, but I suppose sometimes vim is not available...