Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Sunday, September 12, 2010

Browse » Home » , , , » How to create large empty file in Linux?

How to create large empty file in Linux?

Ok friends, after creating a large amount of files (but empty) in windows, now we can also create a empty file in linux too.
For this purpose we must a single commands and ..........

Trick : - 

# dd if=/dev/zero of=filename bs=1024 count=desired

Example to create a 1GB file:
dd if=/dev/zero of=file_1GB bs=1024 count=1000
dd if=/dev/zero of=file_1GB bs=4096 count=250
dd if=/dev/zero of=file_1GB bs=2048 count=500

Example to create a 2GB file:

dd if=/dev/zero of=file_2GB bs=2048 count=1000
dd if=/dev/zero of=file_2GB bs=1024 count=2000

Example to create a 512MB file:

dd if=/dev/zero of=file_512MB bs=1024 count=500
dd if=/dev/zero of=file_1GB bs=512 count=1000

either use

# mkfile size myfile

where can be in KB, MB or GB using k, m or g as suffix. To create a 10 GB file, use

# mkfile 10240m myfile

Ifyou run # mkfile -n 10240m myfile the file will be created, but thedisk blocks will not get allocated, only when writing data into thefile.
You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.


Post a Comment

Back to Top