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. 

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.