Sometimes we need big files for testing purposes, without any concern for the files' content. For example, when testing uploads, downloads & responding to changes in network performance, we are likely to want files of various sizes.
macOS comes with a helpful utility command to create a file of any size over 512 bytes called
$ mkfile FILE_SIZE FILE_NAME
`FILE_SIZE`option, we can optionally use a suffixes to note the unit of the value
`b`- bytes (the deafult),
`m`- megabytes or
For example, the following command produces an empty two gigabyte file named
$ mkfile 2g big-file.ext
Note the following multiplication factors are applied to the
|512||For 512 bytes: |
|1024||For 1kb (1024 bytes): |
|1048576||For 1mb (1,048,576 bytes): |
|1073741824||For 1mb (1,073,741,824 bytes): |
See the man page for
`mkfile`for more information.
$ man mkfile