If it's zeros to a file, then the obvious one is:
dd if=/dev/zero of=file.bin bs=1 count=128
Note that this is pretty inefficient as it goes, as it does single byte writes. You could just as easily use:
dd if=/dev/zero of=file.bin bs=128 count=1
Here, bs' is the 'block size' and
count` is how many blocks. Better to write one block than lots of little ones!
Note that the above commands do not append to file.bin
, they overwrite it. One way round that is:
dd if=/dev/zero bs=128 count=1 >> file.bin
Explanation: in the absence of of=
, dd
writes to standard output, which is then appended to the output file.
echo
should process-e
and-n
, but just in case you're running that script withsh myscript.sh
, take into account thatsh
might be a different shell.