How to generate a large files for testing

You can generate large files for testing on both Linux and Windows machines without having to leverage a 3rd party utility.

Windows

In Windows, you can use the fsutil utility to create a new file with a defined number of bytes. In this case, the following command will generate a 1 GB file. The contents of the file will consist of spaces.

fsutil file createnew "C:\Users\<username>\Desktop\sample.txt" 1073741824

Linux

In Linux, you can use the dd utility. In this case, this command will create a 1 GB file filled with 0s. The bs parameter is the block size and count is the number of blocks to create.

dd if=/dev/zero of=testFile_dd bs=512M count=2

Leave a Reply

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