dd command to create large size file in linux

 

 dd command to create large size file in linux

This post shall explain you how to create larger file using dd command. Using dd command we may achieve multiple task in linux / Unix. This is a small example of it. In this post i am going to explain how to create 1GB size of file using dd command.

 

 

Step1: First of all get the size of the 1GB in KB format. To get that Google is our best friend.

 

ok now we got the size of the 1GB in KB format. Lets go to command prompt and create file.

Step2: Check whether a file is their with the name of test in /

# du -sh /test
du: cannot access `/test': No such file or directory

Step3: Create 1GB file using dd command

# dd if=/dev/zero of=/test bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
1073741824 bytes (1.1 GB) copied, 11.5369 seconds, 93.1 MB/s

 

  • if=/dev/zero .Read from file /dev/zero. It will create blocks full of zero’s.
  • of=/test    .Write to /test file instead of stdout
  • bs=1024 .Create file as 1024 byte per seconds
  • count=1048576 .Total size in KB format

 

Step4: Verify the size using below command

# du -sh /test
1.1G    /test