Previously, I’ve used a few methods to create files in OS X using touch, dd, etc. But the easiest way to create empty files is using the mkfile command, which instantly creates a file of any size. To use the mkfile command, use the following general syntax:
mkfile -n size[b|k|m|g] filename
Using the above, to create a 2GB file called “TESTFILE” on the desktop, use the following command:
mkfile -n 2g ~/Desktop/TESTFILE
The file is created instantly and occupies the desired space on the disk. If you cat the file you should see a whole lot of zeros. I use dd for testing throughput (e.g. to large storage arrays) as there are more options, but mkfile is a useful tool as well. When you use Disk Utility to generate files, you’re basically just piping to mkfile, so this gives you a programmatic way to do so from the command line. Enjoy.
I walked into my office and caught people playing Dungeons and Dragons. It brought a smile to my face. I haven’t played since I was in the 8th grade (or 7th) but I remember those days fondly, with Rob, Jason, Steve, etc. And seeing that my office is as geeky as it should made me very happy. It was on a Saturday, btw, so they weren’t playing D&D instead of working. 🙂