Translate

Archives

Write all 1s to file using dd

It is easy to create a file consisting of all zeros in Linux using dd and the /dev/zero device. $ dd if=/dev/zero count=100 bs=1 > outfile So how do you create a file consisting of all binary ones? There is no device to create binary ones so you have to do something like the following: $ dd if=/dev/zero count=100 bs=1 | tr “00” “377” > outfile You can use xxd to see the contents of the resultant file: $ xxd -b outfile 0000000: 11111111 11111111 11111111 11111111 11111111 11111111 …… 0000006: 11111111 11111111 11111111 11111111 11111111 11111111 …… 000000c: 11111111