For testing a share, a backup target or an upload limit I want a file of a known size, without hunting for something big to copy.
macOS ships mkfile for that:
mkfile -v 100m /tmp/test-100m.bin
The size takes a suffix: b for 512 bytes, k, m or g, and plain bytes if you leave it out. -v reports the name and size of each file it creates. By default the file is padded with zeroes, so it really occupies the space.
With -n the size is noted, but the man page says disk blocks are not allocated until data is written to them:
mkfile -n 10g /tmp/sparse-10g.bin
Compare the two views of that file with ls -lh /tmp/sparse-10g.bin and du -h /tmp/sparse-10g.bin. The first shows the size you asked for, the second what the disk actually holds. It is a quick way to check how a tool handles a very large file without using the space.
You can list several files in one command, each with the same size, and clean up afterwards with rm /tmp/test-100m.bin /tmp/sparse-10g.bin. Check the names before you press Return, because rm does not ask.
The caveat is that these files are zeros. A transfer that compresses on the way will look much faster than it would with real data, and a sparse file with -n has no data behind it at all, so it says little about disk speed. The man page itself describes mkfile as a tool for files used as NFS-mounted swap areas, so using it for test files is a side use.
Further reading: mkfile man page