How to Create a Dummy File in Linux

Linux Distros

Ever needed to quickly test upload/download speeds to and from your Linux web server? Create a dummy file in Linux of a fixed size for this exact purpose and get a real world connection test without any advanced software needed. When running a Linux server, the dd command(convert and copy a file) can be used for exactly this purpose, and it’s a pretty simple process.

To create a dummy file in Linux of 50MB, we first need to convert the file size into bytes (1024 x 1024 x 50 = 52428800) and then enter the following at the command prompt:

dd if=/dev/zero of=yourfilename.test bs=52428800 count=1

*change “yourfilename” to whatever you wish to call the file.

The file will then be created within the folder that you are currently in and the following output will be displayed upon successful creation(time and write speed details will obviously vary slightly):

1+0 records in
1+0 records out
5242880 bytes (50 MB) copied, 0.312 s, 33.6 MB/s

If you want to confirm the file’s creation and size details, just enter the following:

ls -lrth yourfilename.test

and then you should get an output that looks similar to below:

-rw-r–r– 1 root root 50M Jan 1 00:00 yourfilename.test

A breakdown of the command elements can be found here.