How to create big files in Linux

There comes a time in every work life where you need a data file for testing purposes and there are none handy. Rather than searching around for a file that fits your needs, the easiest thing to do is simply to generate one.

We can use 'dd' command to quickly generate a file of any size.

For example the command to create a file with 1G is,

#dd if=/dev/zero of=file.txt count=1024 bs=1048576

This will write  1024 tape blocks of 1048674 (1Mb) bytes.

Here we need to change the values of 'bs' and 'count' according to our needs.


Leave a Reply