For finding mklement0's solution more easily, I turned their comment into this answer:
Pragmatically, you could just run
dd if=/dev/zero bs=1 | sleep 999
in the foreground, wait a second, then press^C
[= ctrl+C].
If you wanted a one-liner on Linux and BSD/macOS (more robust than using killall):
dd if=/dev/zero bs=1 | sleep 999 & sleep 1 && pkill -INT -P $$ -x dd
With GNU timeout
you can simplify this to ...
timeout -s INT 3 dd if=/dev/zero bs=1 | sleep 99
Either way, the output will be something like below.
65537+0 records in65536+0 records out65536 bytes (66 kB, 64 KiB) copied, 2.99738 s, 21.9 kB/s
In above example, my buffer was 65536 bytes.dd
couldn't write the 65537th byte, because the buffer was full.