• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

CLI with style?

So, I came across in a shell script while I was tinkering:

bash -c 'cat src/build/images/amd64-generic/R39-6242.0.2014_09_07_0823-a1/chromiumos_image.bin | dd of=/dev/sdb bs=4M iflag=fullblock oflag=sync'

Is there an advantage to doing it this way as opposed to just specifying an "if=" in the dd command? (Is it maybe more shell-agostic or something?)
 
I'll just preface my response with I've never used dd.

From what I understand, the "if=" command can be used for what you're attempting to do. However, make sure "if=" is put before "of=" otherwise dd will live up to its nickname of "data destroyer". 😀
 
I'll just preface my response with I've never used dd.

From what I understand, the "if=" command can be used for what you're attempting to do. However, make sure "if=" is put before "of=" otherwise dd will live up to its nickname of "data destroyer". 😀

I've always used if=, but I also don't use dd much. When I use it, I check and double check everything so I don't make a bad mistake.
 
I think it was written like that because it was in a shell script. Using the "if=" command is more common and will achieve the same thing.
 
`cat` uses 4KiB buffers by default and is a little more efficient than `dd` because it doesn't use memcpy. It can be possible that the args for your `dd if=` are not optimal for the destination `of=`, so you separate them by a pipe. And in those cases, among others,`cat` can be better for the situation than `dd`.

If you're interested in the performance delta, for each method you can clear the system cache and time the run, to compare.
 
Why not:

cat src/build/images/amd64-generic/R39-6242.0.2014_09_07_0823-a1/chromiumos_image.bin > /dev/sdb

Does this not give a similar result?
 
Why not:

cat src/build/images/amd64-generic/R39-6242.0.2014_09_07_0823-a1/chromiumos_image.bin > /dev/sdb

Does this not give a similar result?

It will, but he will miss the arguments "bs=4M iflag=fullblock", which might differ using the cat command.
 
Back
Top