My Technical Notes

Wednesday, 1 June 2016

Creating a Large, Empty File

You can use the `dd` command to create a large, empty file. This can be used for testing an upload feature of a web application, to ensure that files of a certain length are allowed or disallowed.

The following code, which can be run in Bash (using, for example, Git Bash), will create a 10 megabyte file, named `test.txt`, in the current directory.

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

No comments: