The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Creating a command history feature in a simple UNIX shell using C -=Cn=- Shell Programming and Scripting 2 11-12-2007 09:04 PM
Help with a shell script for creating a log file heprox Shell Programming and Scripting 2 11-13-2006 10:00 PM
Creating database in shell, how?! vants UNIX for Advanced & Expert Users 1 10-18-2005 04:00 PM
Creating my first Shell Script plmahan Shell Programming and Scripting 1 11-21-2004 07:32 PM
Creating new shell in C passat High Level Programming 4 06-06-2001 08:52 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-29-2006
Registered User
 

Join Date: Feb 2006
Posts: 22
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!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-29-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,638
Try this.

Code:
dd if=/dev/zero of=output.file bs=1024 count=1024
It will be filled with /dev/zero's
Reply With Quote
  #3 (permalink)  
Old 04-04-2006
Registered User
 

Join Date: Feb 2006
Posts: 22
Explaination clearly....

Hi Thanks for the reply....
I would like to be explained in detail
Reply With Quote
  #4 (permalink)  
Old 04-04-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,638
Look into man dd. Or better yet info dd
Reply With Quote
  #5 (permalink)  
Old 04-04-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,454
Quote:
Originally Posted by vino
Try this.

Code:
dd if=/dev/zero of=output.file bs=1024 count=1024
It will be filled with /dev/zero's
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.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:13 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0