Friday, January 28, 2011

Creating an empty file having a specific size using dd command

Using the most popular dd command in Linux/Unix you can create a file having a
specific size. It can be Created for Testing purpose. Example when you are configuring disk quota.

dd if=/dev/zero of=example.txt  bs=1M count=1024
It will create an empty file of size 1GB

Here  if = input file , of = output file (it could be any name which you want), bs= block size, here I have mentioned M, it specifies MB(mega byte), if you want to create a file in KB(kilo byte) you need to specify bs with k( bs=10k).

1 comment:

  1. Thank you, this is very helpful for testing a jquery upload progress bar.

    ReplyDelete