Createing test files in linux

So you want to test an upload in linux and need a file to test with? That test also needs to be 20megs in size? Well good news everybody this can easily be done in linux. Using the command “dd” does low level coping of data. It can create a wide variety of files and can be used to destroy systems to backing up boot sectors and everything in between. Now on to the test file creation!

dd if=/dev/zero of=test20mb.zip bs=1024 count=0 seek=$[1024*20]

dd if=/dev/zero of=test20mb.zip bs=1024 count=0 seek=$[1024*20]
This will create a file called test20mb.zip It will be filled with just nothing (null/zeros). Using a block size of 1024. It will then seek for a given number of times. In this case 1024 * 20. 1 mb * 20.

200 mb .img

dd if=/dev/zero of=test200mb.img bs=1024 count=0 seek=$[1024*200]

15 mb .doc

dd if=/dev/zero of=test15mb.doc bs=1024 count=0 seek=$[1024*15]

8 mb .jpg

dd if=/dev/zero of=test8mb.jpg bs=1024 count=0 seek=$[1024*8]

Creating these on the fly or having a set already made can make it much easier to test upload and sending issues you might come across. But at times you still will need a legit working file and need to find something that fots for the size and type you are testing.

Leave a Reply

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