Join my Laravel for REST API's course on Udemy 👀

Create a file of specific size in Linux

March 13, 2020  ‐ 1 min read

While testing an upload service for example you probably need to test it with a large file. On the Linux command-line you can create such a file with the dd command.

To generate a file of 10MB you can run the following command. This will create a file called largefile.txt in your current directory filled with zeros. If you prefer random data instead of zeros you will have to replace /dev/zero by /dev/urandom.

$ dd if=/dev/zero of=largefile.txt bs=1M count=10.