Create dummy file

dd if=/dev/zero of=filename.file bs=1024 count=10240
Command to create a dummy file (full of nulls). Useful for testing e.g. file transfers when no file is at hand. bs = blocksize, count = filesize in kilobytes

By: harpo
2012-01-19 08:38:14

What Others Think

Not a sparse file, just a file full of nulls. Sparse is done like so: dd of=<FILE> bs=1M seek=10 count=0 for a 10 meg file, etc.
h3xx · 391 weeks and 1 day ago
* check by comparing "ls -lah " and "du -h " after you make it. A 10mb sparse file reads 10k with du.
h3xx · 391 weeks and 1 day ago
harpo · 391 weeks and 1 day ago
totti · 391 weeks ago
Count is in 'bs bytes' not kb. In this case in kb. I think this one is a duplicate.
totti · 391 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: