How To Create A File With Specified Size In Linux

Q: Coinstar point How can I create a file with custom size in linux ?


You can create a file using the dd command in linux

dd if=/dev/zero of=/root/keyfile bs=1M count=1024

This will create a file at /root/keyfile with 1024MB size.

dd if=/dev/urandom of=/root/keyfile bs=1024 count=4

This will create a file with random content with the size of 4096 bits.

Leave a Reply

Your email address will not be published.