Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 May 2003 18:49:09 -0700
From:      Ed Hall <edhall@weirdnoise.com>
To:        Andy Farkas <andyf@speednet.com.au>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Zeros and ones 
Message-ID:  <200305030149.h431n92e039390@screech.weirdnoise.com>
In-Reply-To: Message from Andy Farkas <andyf@speednet.com.au>  <20030503095717.G67119-100000@hewey.af.speednet.com.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 3 May 2003 09:58:11 +1000Andy Farkas <andyf@speednet.com.au> wrote:
> On Fri, 2 May 2003, Jerry McAllister wrote:
> 
> > It is easy and convenient to use /dev/zero to write out a number of
> > zero bytes to somewhere - as in:
> >
> >           dd if=/dev/zero of=zerofile bs=512 count=1770000
> >                 or
> >           dd if=/dev/zero of=/dev/da1 bs=512 count=1770000
> >
> > But, I would like to write all ones - as in 0xff or maybe some
> > other pattern - as if there was a /dev/one also.
> >
> > Is there a nice way to do this using UNIXistic stringing existing
> > stuff together?   Or do I have to write a little piece of code?
> >
> > Thanks for any [positive] suggestions.
> >
> > ////jerry
> 
> Play around with jot(1).
> 

Specifically,

    jot -c -s '' -n {size} {byte} - 0 >file

will output {size} bytes of value {byte} (both values specified in decimal)
into "file".

		-Ed




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305030149.h431n92e039390>