Linux: How to Generate a File of Random Data

There are several methods you could use to generate a file filed with random data under Linux. In the example below dd has been used to generate 1,000,000 bytes of random data.

dd if=/dev/urandom of=./randI.hex bs=1MB count=1

If you want a file filed with zeros you could substitute /dev/urandom with /dev/zero.