Linux: Bash: Create a empty file of an specific size


dd if=/dev/zero of=1MBfile bs=1024 count=$((1 * 1024))

The above command will create an empty file named “1MBfile” which is 1 MegaByte large.

Name is defined at the “of” parameter. Size is defined by the number of blocks (variable “count”) times the size of each block (defined by “bs”).

In this example, we have 1024 blocks of 1024 bytes size each. 

Leave a Reply