For my work and personal projects, I sometimes need to create large files greater than 100MB, sometimes 500MB and often 1GB, 5GB, 10GB up to 100GB.

There are many ways to create large files with random content, but we will focus on the dd command in this blog post.
Create 1GB file with random content
This command will create a 1GB file 1gbfile.bin with random junk content.
dd if=/dev/zero of=1gbfile.bin bs=1G count=1
Output:
-rw-r--r-- 1 asjohn staff 1.0G Dec 16 23:15 1gbfile.bin
Create 2GB file
This command will create a 2GB file 2gbfile.bin with random junk content.
bs stands for block size. Note that when the file is greater than 2GB, we will use the seek option and set block size to 1.
dd if=/dev/zero of=2gbfile.bin bs=1 count=0 seek=2G
Output:
-rw-r--r-- 1 arul staff 2.0G Dec 16 23:14 2gbfile.bin
Create 5GB file
This command will create a 5GB file fivegbfile.bin with random junk content.
dd if=/dev/zero of=fivegbfile.bin bs=1 count=0 seek=5G
Output:
-rw-r--r-- 1 arul staff 5.0G Dec 16 23:16 fivegbfile.bin
Create 10GB file
This command will create a 10GB file tengbfile.bin with random junk content.
dd if=/dev/zero of=tengbfile.bin bs=1 count=0 seek=10G
Output:
-rw-r--r-- 1 arul staff 10G Dec 16 23:17 tengbfile.bin
Create 15GB file
This command will create a 15GB file 15gbfile.bin with random junk content.
dd if=/dev/zero of=15gbfile.bin bs=1 count=0 seek=15G
Output:
$ ls -lh *bin
-rw-r--r-- 1 arul staff 15G Dec 16 23:18 15gbfile.bin
Create 20GB file
This command will create a 20GB file 20gbfile.bin with random junk content.
dd if=/dev/zero of=20gbfile.bin bs=1 count=0 seek=20G
Output:
$ dd if=/dev/zero of=20gbfile.bin bs=1 count=0 seek=20G
0+0 records in
0+0 records out
0 bytes transferred in 0.000019 secs (0 bytes/sec)
$ ls -lh *bin
-rw-r--r-- 1 arul staff 20G Dec 16 23:20 20gbfile.bin
Create 100GB file
This command will create a 100GB file 100gbfile.bin with random junk content. Just make sure you have enough available disk space before running this command.
dd if=/dev/zero of=100gbfile.bin bs=1 count=0 seek=100G
Conclusion
If you were able to create or not create a file with random junk content, let us know. Hope this blog post was useful. Thanks for reading.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.