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).
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).