1*fc99b6a4Ssnj.\" $NetBSD: progress.1,v 1.15 2014/04/13 01:45:34 snj Exp $ 298f6cccbSjhawk.\" 33d05e3a2Slukem.\" Copyright (c) 2003-2007 The NetBSD Foundation, Inc. 498f6cccbSjhawk.\" All rights reserved. 598f6cccbSjhawk.\" 698f6cccbSjhawk.\" This code is derived from software contributed to The NetBSD Foundation 798f6cccbSjhawk.\" by John Hawkinson. 898f6cccbSjhawk.\" 998f6cccbSjhawk.\" Redistribution and use in source and binary forms, with or without 1098f6cccbSjhawk.\" modification, are permitted provided that the following conditions 1198f6cccbSjhawk.\" are met: 1298f6cccbSjhawk.\" 1. Redistributions of source code must retain the above copyright 1398f6cccbSjhawk.\" notice, this list of conditions and the following disclaimer. 1498f6cccbSjhawk.\" 2. Redistributions in binary form must reproduce the above copyright 1598f6cccbSjhawk.\" notice, this list of conditions and the following disclaimer in the 1698f6cccbSjhawk.\" documentation and/or other materials provided with the distribution. 1798f6cccbSjhawk.\" 1898f6cccbSjhawk.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1998f6cccbSjhawk.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2098f6cccbSjhawk.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2198f6cccbSjhawk.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2298f6cccbSjhawk.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2398f6cccbSjhawk.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2498f6cccbSjhawk.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2598f6cccbSjhawk.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2698f6cccbSjhawk.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2798f6cccbSjhawk.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2898f6cccbSjhawk.\" POSSIBILITY OF SUCH DAMAGE. 2998f6cccbSjhawk.\" 30ac798ebcSbriggs.Dd June 6, 2007 3198f6cccbSjhawk.Dt PROGRESS 1 3298f6cccbSjhawk.Os 3398f6cccbSjhawk.Sh NAME 3498f6cccbSjhawk.Nm progress 3598f6cccbSjhawk.Nd feed input to a command, displaying a progress bar 3698f6cccbSjhawk.Sh SYNOPSIS 3798f6cccbSjhawk.Nm 38ddd39082Sgarbled.Op Fl ez 39ac798ebcSbriggs.Op Fl b Ar buffersize 4098f6cccbSjhawk.Op Fl f Ar file 4198f6cccbSjhawk.Op Fl l Ar length 42849866f9Shubertf.Op Fl p Ar prefix 4398f6cccbSjhawk.Ar cmd 4498f6cccbSjhawk.Op Ar args ... 4598f6cccbSjhawk.Sh DESCRIPTION 4698f6cccbSjhawkThe 4798f6cccbSjhawk.Nm 4898f6cccbSjhawkutility opens a pipe to 4998f6cccbSjhawk.Ar cmd 5098f6cccbSjhawkand feeds an input stream into it, while displaying a progress bar to 5198f6cccbSjhawkstandard output. 5298f6cccbSjhawkIf no filename is specified, 5398f6cccbSjhawk.Nm 5498f6cccbSjhawkreads from standard input. 5598f6cccbSjhawkWhere feasible, 5698f6cccbSjhawk.Nm 5798f6cccbSjhawk.Xr fstat 2 Ns s 5898f6cccbSjhawkthe input to determine the length, so a time estimate can be calculated. 5998f6cccbSjhawk.Pp 6098f6cccbSjhawkIf no length is specified or determined, 6198f6cccbSjhawk.Nm 6298f6cccbSjhawksimply displays a count of the data and the data rate. 6398f6cccbSjhawk.Pp 6498f6cccbSjhawkThe options are as follows: 6598f6cccbSjhawk.Bl -tag -width XlXlengthXX 66ac798ebcSbriggs.It Fl b Ar buffersize 67ac798ebcSbriggsRead in buffers of the specified size (default 64k). 68ac798ebcSbriggsAn optional suffix (per 69ac798ebcSbriggs.Xr strsuftoll 3 ) 70ac798ebcSbriggsmay be given. 71ddd39082Sgarbled.It Fl e 72ddd39082SgarbledDisplay progress to standard error instead of standard output. 7398f6cccbSjhawk.It Fl f Ar file 7498f6cccbSjhawkRead from the specified 7598f6cccbSjhawk.Ar file 7698f6cccbSjhawkinstead of standard input. 7798f6cccbSjhawk.It Fl l Ar length 7898f6cccbSjhawkUse the specified length for the time estimate, rather than attempting to 7998f6cccbSjhawk.Xr fstat 2 8098f6cccbSjhawkthe input. 81f9f551dbSlukemAn optional suffix (per 82f9f551dbSlukem.Xr strsuftoll 3 ) 83f9f551dbSlukemmay be given. 84849866f9Shubertf.It Fl p Ar prefix 85849866f9ShubertfPrint the given 86849866f9Shubertf.Dq prefix 87849866f9Shubertftext before (left of) the progress bar. 8898f6cccbSjhawk.It Fl z 8998f6cccbSjhawkFilter the input through 9089cb93c0Shubertf.Xr gunzip 1 . 9198f6cccbSjhawkIf 9298f6cccbSjhawk.Fl f 9398f6cccbSjhawkis specified, calculate the length using 9498f6cccbSjhawk.Ic gzip -l . 9598f6cccbSjhawk.El 9698f6cccbSjhawk.Sh EXIT STATUS 97*fc99b6a4Ssnj.Ex -std 9898f6cccbSjhawk.Sh EXAMPLES 9998f6cccbSjhawkThe command 100f9f551dbSlukem.Dl progress -zf file.tar.gz tar xf - 10198f6cccbSjhawkwill extract the 10298f6cccbSjhawk.Pa file.tar.gz 10398f6cccbSjhawkdisplaying the progress bar as time passes: 10498f6cccbSjhawk.Bd -literal 1053d05e3a2Slukem 0% | | 0 0.00 KiB/s --:-- ETA 1063d05e3a2Slukem 40% |******** | 273 KiB 271.95 KiB/s 00:01 ETA 1073d05e3a2Slukem 81% |*********************** | 553 KiB 274.61 KiB/s 00:00 ETA 1083d05e3a2Slukem100% |*******************************| 680 KiB 264.59 KiB/s 00:00 ETA 10998f6cccbSjhawk.Ed 11098f6cccbSjhawk.Pp 11198f6cccbSjhawkIf it is preferred to monitor the progress of the decompression 11298f6cccbSjhawkprocess (unlikely), then 113f9f551dbSlukem.Dl progress -f file.tar.gz tar zxf - 11498f6cccbSjhawkcould be used. 115f9f551dbSlukem.Pp 116f9f551dbSlukemThe command 117f9f551dbSlukem.Dl dd if=/dev/rwd0d ibs=64k | \e 118f9f551dbSlukem.Dl progress -l 120g dd of=/dev/rwd1d obs=64k 1193d05e3a2Slukemwill copy the 120 GiB disk 120f9f551dbSlukem.Sy wd0 121f9f551dbSlukem.Pa ( /dev/rwd0d ) 122f9f551dbSlukemto 123f9f551dbSlukem.Sy wd1 124f9f551dbSlukem.Pa ( /dev/rwd1d ) , 125f9f551dbSlukemdisplaying a progress bar during the operation. 12698f6cccbSjhawk.Sh SEE ALSO 127f9f551dbSlukem.Xr ftp 1 , 128f9f551dbSlukem.Xr strsuftoll 3 12998f6cccbSjhawk.Sh HISTORY 13098f6cccbSjhawk.Nm 13198f6cccbSjhawkfirst appeared in 13298f6cccbSjhawk.Nx 1.6.1 . 13398f6cccbSjhawkThe dynamic progress bar display code is part of 1348d469d6cSlukem.Xr ftp 1 . 13598f6cccbSjhawk.Sh AUTHORS 13698f6cccbSjhawk.Nm 13798f6cccbSjhawkwas written by 1382ceb8458Sgrant.An John Hawkinson 1392ceb8458Sgrant.Aq jhawk@NetBSD.org . 14098f6cccbSjhawk.Xr ftp 1 Ns 's 14198f6cccbSjhawkdynamic progress bar was written by Luke Mewburn. 14298f6cccbSjhawk.Sh BUGS 14398f6cccbSjhawkSince the progress bar is displayed asynchronously, it may be 14498f6cccbSjhawkdifficult to read some error messages, both those produced by the 14598f6cccbSjhawkpipeline, as well as those produced by 14698f6cccbSjhawk.Nm 14798f6cccbSjhawkitself. 148