Site icon Bytefreaks.net

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

Advertisements

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: Αγγλικα

Exit mobile version