> On Fri, 1 Feb 2002 15:22:51 +0800
> "Jason Lim" <mail...@jasonlim.com> wrote:
>
>> Hi,
>>
>> Just wanted to know... how do I make a file with all 1s or 0s or
>> something with a certain size (eg. 100Mb)?
>>
>> I was thinking 'dd something' but there is probably a better way?
>
> why not dd?
>
> dd if=/dev/zero of=/tmp/yourfile bs=1m count=100
>
Also, piping through tr could be handy.
dd if=/dev/zero bs=1m count=100 |tr "\0" "1" > /tmp/yourfile
==============================
David Stanaway
Personal: da...@stanaway.net
Work: da...@netventures.com.au
--
To UNSUBSCRIBE, email to debian-is...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
I was doing if=/dev/random (forgot all about /dev/zero), and it was taking
a very long time to get even near 100M, so I thought there would be a
better way. Using /dev/zero helped a lot... and I could use tr to change
them to 1s (created two versions... but I think both would be
approximately the same speed).
Thanks again.
> dd if=/dev/zero of=/tmp/yourfile bs=1m count=100
> dd if=/dev/zero bs=1m count=100 |tr "\0" "1" > /tmp/yourfile
--
I'm not surprised /dev/random was slow. This is the "true" random number
generator that relys on entropy collected from truely random events like
key-presses, serial interrupts, etc. This means it will stall when it runs
out of entropy. Bashing keys and wiggling your mouse will speed it up, as
this feeds it more entropy.
If you would be content with "almost" random numbers, use /dev/urandom. This
uses /dev/random to seed a random-number generator. This means it is still
pretty random, but it doesn't stall when /dev/random runs out of entropy.
--
----------------------------------------------------------------------
ABO: finger a...@minkirri.apana.org.au for more info, including pgp key
----------------------------------------------------------------------