User Tools

Site Tools


How to create a file of a given size on Linux?

updated: 03 Sep 2008

You can create a file with a given size using dd command.

$ cd tmp # use /tmp, wiki doesn't allow it
$ dd if=/dev/zero of=testfile bs=1M count=10

This will create a /tmp/testfile with size 10 MB. What this means:

  • if - input file, in this case the special /dev/zero
  • of - output file, in this case /tmp/testfile
  • bs - block size (here 1 MByte)
  • count - how many blocks (size bs)
linux/create_file.txt · Last modified: 2013/03/16 17:40 (external edit)