Make a big file quickly on Linux

Sometimes you need a huge dummy file for some reason: maybe you want to test network performance, or maybe you want to fool a file sharing application, or there is some other weird reason. On OSX and BSD, I have read there exists a program called mkfile. But I did not find it on Ubuntu so a bit of looking around I came across truncate. Just use the command
truncate -s 1000MB filename.out
This will create a file called filename.out with a size of 1000MB. The space is not actually allocated on the hard disk but the file entry exists in the file table. See man truncate for more information.

© 2014. All rights reserved.