3 ms·
one could use: cat foobar.img | sudo tee /dev/sdi > /dev/null
by mercora 10y ago
one could use:
cat foobar.img | sudo tee /dev/sdi > /dev/null
- JoshTriplett 10y agoI've used that to write short files (such as settings in /sys or /proc), but for large files, tee has the disadvantage of writing everything twice, and the pipe adds another write and read of every byte.
- mercora 10y agoI just realized this too and tried to close stdout instead. tee complains about it but goes on with its business: cat foobar.img | sudo tee /dev/sdi >&-
- RJIb8RBYxzAMX9u 10y agoWhy's everyone so against dd? :-) If you're going to use tee, might as well not bother with cat at all[0]: $ 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_cat https://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_... [1] http://www.ivarch.com/programs/pv.shtml http://www.ivarch.com/programs/pv.shtml
- mercora 10y agoThanks for the reminder :) I do fall quite often for the useless use of cat. But most of the time i also do not really care about it much. I did omit pv in believe tee will always be available but it is great and absolutely preferred when available.