Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


creating file of 1MB using shell command?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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!
# 2  
Try this.

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

It will be filled with /dev/zero's
# 4  
Look into man dd. Or better yet info dd
# 5  
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,
Code:
dd if=/dev/zero of=output.file bs=1024 count=1024

time taken = 0.13 s
Code:
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.

Last edited by Yogesh Sawant; 02-26-2010 at 02:39 PM.. Reason: added code tags
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
rename a file if it exceeds 1MB in size
jamie_collins
Hi all. I am trying to write a script that renames a logfile if it exceeds roughly 1 MB. My find command is: find some_logfile -type f -size +20000 Now I want to do my processing if it finds a file or not... How can I go about this? The $? is 0 if it finds a file or not. All...... UNIX for Dummies Questions & Answers
4
UNIX for Dummies Questions & Answers
Creating File using the CAT Command
Ravi Pavanv
Hello , I am newbie to UNIX platform . I have read that there are two ways of creating files that is using 1.) Cat 2.) touch . With Cat Command i am unable to create a File , i is saying No file or Directory exists I logged in with root as user . please help... UNIX for Dummies Questions & Answers
7
UNIX for Dummies Questions & Answers
Creating a command on a BASH shell
hresquivelo
Hi all. Suppose I have the following function in an executable file named "HOLA": ------------------------ function hola { echo "Hola ${@}."; } ------------------------ In addition, suppose that I want to execute the file so I can input my name next to ./HOLA. I mean,...... Shell Programming and Scripting
4
Shell Programming and Scripting
Creating a command history feature in a simple UNIX shell using C
-=Cn=-
I'm trying to write a history feature to a very simple UNIX shell that will list the last 10 commands used when control-c is pressed. A user can then run a previous command by typing r x, where x is the first letter of the command. I'm having quite a bit of trouble figuring out what I need to do, I...... Shell Programming and Scripting
2
Shell Programming and Scripting
Help with a shell script for creating a log file
heprox
I have a schell script that runs continously on an AIX system. It is actually started from another shell script with the "ksh -x" command and then I just write the output to a log file. This causes the log files to be filled with mostly useless information. I would like to modify this script to...... Shell Programming and Scripting
2
Shell Programming and Scripting

Featured Tech Videos