Creating Large Dummy Files on Linux

archive

Sometimes you run into a situation where you need to test handling large files, measure bandwidth speeds, or maybe you just want to create a bunch of junk files to take up space — let’s hope not, but no judgment here. 🙂

Here’s a quick and simple way to do just that.

1. Go to the directory where you want to create the file

cd /tmp

2. Create the file

dd if=/dev/zero of=100mbFile.bin bs=1M count=100

Done!

This will create a file named 100mbFile.bin that is — you guessed it — 100 MB in size.

Things to remember

  • dd — copies and converts raw data
  • of=[FILE] — writes output to a file
  • bs=[BYTES] — sets the block size for reading and writing
  • count=[BLOCKS] — copies only the specified number of input blocks

That’s it. Just that simple.

If you need more information on dd, check out the Wikipedia article.