"This is a strange program of obscure provenance that somehow, still manages to survive in the 21st century."<p>-> links to wikipedia page with direct discription of lineage back to 5th ed research unix<p>"That weird bs=4M argument in the dd version isn’t actually doing anything special—all it’s doing is instructing the dd command to use a 4 MB buffer size while copying. But who cares? Why not just let the command figure out the right buffer size automatically?"<p>Um -<p>a) it is 'doing the special thing' of changing the <i>block</i> size (not buffer size)<p>b) Because the command probably doesn't figure out the right size automatically, much like your 'cat' example above which also doesn't<p>c) And this can mean massive performance differences between invocations<p>> Another reason to prefer the cat variant is that it lets you actually string together a normal shell pipeline. For instance, if you want progress information with cat you can combine it with the pv command<p>Umm:<p><pre><code> dd if=file bs=some-optimal-block-size | rest-of-pipeline
</code></pre>
that was hard.<p>>If you want to create a file of a certain size, you can do so using other standard programs like head. For instance, here are two ways to create a 100 MB file containing all zeroes:<p><pre><code> $ uname -sr
OpenBSD 6.0
$ head -c 10MB /dev/zero
head: unknown option -- c
usage: head [-count | -n count] [file ...]
</code></pre>
well.. guess that wasn't so 'standard' after all..
I must be using some nonstandard version...<p><pre><code> $ man head |sed -ne 47,51p
HISTORY
The head utility first appeared in 1BSD.
AUTHORS
Bill Joy, August 24, 1977.
$ sed -ne 4p /usr/src/usr.bin/head/head.c
* Copyright (c) 1980, 1987 Regents of the University of California.
</code></pre>
Hmm..<p>> So if you find yourself doing that a lot, I won’t blame you for reaching for dd. But otherwise, try to stick to more standard Unix tools.<p>Like 'pv'?<p>edit: added formatting, sector size note, head manpage/head.c stuffs.. apologies.