Create 1GB File With Random Data Using Debian’s Terminal

The first question is obvious – Why would anyone want to do that?¬†Apart from reason because he can ūüėÄ there is a really good one – when you need to test speed of your network or hard drives – you just create a file of needed size and copy it to other place (or wget it).

So how to do it? It’s fairly easy:

dd if=/dev/random of=1GB_file.bin bs=1024 count=1073741824
so what it does?

dd  is disk manipulation utility

if=/dev/random where to read from (so it reads random data)

of=1GB_file.bin where to write file and its filename (1GB_file.bin)

bs=1024 read and write up to 1024 bytes at a time, this is quite conservative value I assume most disk would handle 8192 or even much larger

count=1073741824 determines how big the file is supposed to be (in bytes), if you need 10MB file replace it with 10485760

P.S. Obviously this mini how-to would work for Ubuntu as well.