In order to create a 10 GB temp file...
In Linux you can do this:
fallocate -l 10G temp_10GB_file
In Windows you can do this:
fsutil file createnew temp_10GB_file 10000000000
...but what about if you're in OS X?
Join Stack Overflow to learn, share knowledge, and build your career.
In order to create a 10 GB temp file...
In Linux you can do this:
fallocate -l 10G temp_10GB_file
In Windows you can do this:
fsutil file createnew temp_10GB_file 10000000000
...but what about if you're in OS X?
macOS has the command mkfile
to achieve the same:
mkfile -n 10g temp_10GB_file
Syntax:
mkfile [ -nv ] size[b|k|m|g] filename ...
And here's the related manual page for mkfile
Cross Platform Alternative (Unix including macOS):
As an alternative you could also you the Unix util dd
:
dd if=/dev/zero of=temp_10GB_file bs=1 count=0 seek=10G
Note that on macOS you need to use a lowercase for the unit as follow:
dd if=/dev/zero of=temp_10GB_file bs=1 count=0 seek=10g
And here's the related manual page for dd
dd
is that you can use if=/dev/urandom
to fill the file with random data instead of zeroes. This may make the resulting file more "realistic" if you need a test file that is going to be subject to compression (e.g. download or ZIP speed test)
– j b
Sep 20 '18 at 9:04