Generate a random file with specific size

It’s possible to easily generate a random file with specific size filled differently depending on the needs:

  • Fill a 200MB file with zeroes
    dd if=/dev/zero of=/tmp/file.out bs=1024KB count=200
    
  • Fill a 200MB file with random values (longer than zeroes – depending on processor)
    dd if=/dev/random of=/tmp/file2.out bs=1024KB count=200