From owner-freebsd-questions@FreeBSD.ORG Fri May 2 17:03:35 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E625837B401 for ; Fri, 2 May 2003 17:03:35 -0700 (PDT) Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by mx1.FreeBSD.org (Postfix) with SMTP id 7DDA043F3F for ; Fri, 2 May 2003 17:03:33 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: (qmail 14757 invoked by uid 1001); 3 May 2003 00:03:31 -0000 Date: Sat, 3 May 2003 02:03:30 +0200 From: Erik Trulsson To: Jerry McAllister Message-ID: <20030503000330.GA98398@falcon.midgard.homeip.net> Mail-Followup-To: Jerry McAllister , freebsd-questions@freebsd.org References: <200305022353.h42NreOY018887@clunix.cl.msu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200305022353.h42NreOY018887@clunix.cl.msu.edu> User-Agent: Mutt/1.5.4i cc: freebsd-questions@freebsd.org Subject: Re: Zeros and ones X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2003 00:03:36 -0000 On Fri, May 02, 2003 at 07:53:40PM -0400, Jerry McAllister wrote: > Hi, > > This should be easy, but short of writing something specific to do it, > I am not getting my head around how. > > 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? Of course there is a nice way. :-) Try something like tr '\000' '\377' < /dev/zero | dd of=onesfile bs=512 count=1770000 to get a file with all bits equal to one. -- Erik Trulsson ertr1013@student.uu.se