creating file of 1MB using shell command?

Hi everybody in the forum,

I want to create an empty file of say some 1MB ,i mean at the command line itself.How is this possible??????EEK!

Try this.

dd if=/dev/zero of=output.file bs=1024 count=1024

It will be filled with /dev/zero's

Hi Thanks for the reply....
I would like to be explained in detail

Look into man dd. Or better yet info dd

this is just a suggestion,
when generating files of huge size,
it is better you attack from the block size thereby reducing the count

for a 1 MB file,

dd if=/dev/zero of=output.file bs=1024 count=1024

time taken = 0.13 s

dd if=/dev/zero of=output.file bs=1048576 count=1

time taken = 0.08 s
it is just a difference of (0.13 - 0.08) s

but consider generating some 200 MB files
attacking block size would surely provide a difference.