Categories
Linux shell

Generate file of fixed size via CLI

We recently moved a hosting to a new data center and wanted to test speeds, so I needed fixed size files to see what kind of speeds people could achieve while downloading them. I decided on the arbitrary numbers of 100MB and 500MB. Heres how I generated fixes size files via bash.

for 500 MB :

dd if=/dev/zero of=file.txt count=1000 bs=524288

for 100MB :

dd if=/dev/zero of=file.txt count=10240 bs=10240

Now you can use other things such as /dev/random etc for this. but this is extremely quick. the 500MB file was finished in .47 seconds. That’s less than half a second….

Leave a Reply

Your email address will not be published. Required fields are marked *