1PV(1)                            User Manuals                            PV(1)
2
3
4

NAME

6       pv - monitor the progress of data through a pipe
7

SYNOPSIS

9       pv [OPTION] [FILE]...
10       pv [-h|-V]
11
12
13

DESCRIPTION

15       pv  shows the progress of data through a pipeline by giving information
16       such as time elapsed, percentage completed (with progress bar), current
17       throughput rate, total data transferred, and ETA.
18
19       To  use it, insert it in a pipeline between two processes, with the ap‐
20       propriate options.  Its standard input will be passed  through  to  its
21       standard output and progress will be shown on standard error.
22
23       pv  will  copy  each  supplied FILE in turn to standard output (- means
24       standard input), or if no FILEs are specified just  standard  input  is
25       copied. This is the same behaviour as cat(1).
26
27       A  simple  example  to  watch  how  quickly a file is transferred using
28       nc(1):
29
30              pv file | nc -w 1 somewhere.com 3000
31
32       A similar example, transferring a file from another process and passing
33       the expected size to pv:
34
35              cat file | pv -s 12345 | nc -w 1 somewhere.com 3000
36
37       A  more  complicated example using numeric output to feed into the dia‐
38       log(1) program for a full-screen progress display:
39
40              (tar cf - . \
41               | pv -n -s $(du -sb . | awk '{print $1}') \
42               | gzip -9 > out.tgz) 2>&1 \
43              | dialog --gauge 'Progress' 7 70
44
45       Taking an image of a disk, skipping errors:
46
47              pv -EE /dev/your/disk/device > disk-image.img
48
49       Writing an image back to a disk:
50
51              pv disk-image.img > /dev/your/disk/device
52
53       Zeroing a disk:
54
55              pv < /dev/zero > /dev/your/disk/device
56
57       Note that if the input size cannot be calculated, and the output  is  a
58       block  device,  then  the  size of the block device will be used and pv
59       will automatically stop at that size as if -S had been given.
60
61       (Linux only): Watching file descriptor  3  opened  by  another  process
62       1234:
63
64              pv -d 1234:3
65
66       (Linux only): Watching all file descriptors used by process 1234:
67
68              pv -d 1234
69
70
71

OPTIONS

73       pv  takes many options, which are divided into display switches, output
74       modifiers, and general options.
75
76
77

DISPLAY SWITCHES

79       If no display switches are specified, pv behaves as if -p, -t, -e,  -r,
80       and  -b had been given (i.e. everything except average rate is switched
81       on).  Otherwise, only those display types that are explicitly  switched
82       on will be shown.
83
84       -p, --progress
85              Turn  the  progress bar on.  If standard input is not a file and
86              no size was given (with the -s modifier), the progress bar  can‐
87              not indicate how close to completion the transfer is, so it will
88              just move left and right to indicate that data is moving.
89
90       -t, --timer
91              Turn the timer on.  This will display  the  total  elapsed  time
92              that pv has been running for.
93
94       -e, --eta
95              Turn  the  ETA  timer  on.  This will attempt to guess, based on
96              current transfer rates and the total data size, how long it will
97              be  before  completion.   This option will have no effect if the
98              total data size cannot be determined.
99
100       -I, --fineta
101              Turn the ETA timer on, but display the estimated local  time  of
102              arrival  instead  of time left.  When the estimated time is more
103              than 6 hours in the future, the date is shown as well.
104
105       -r, --rate
106              Turn the rate counter on.  This will display the current rate of
107              data transfer.
108
109       -a, --average-rate
110              Turn the average rate counter on.  This will display the current
111              average rate of data transfer (default: last 30s, see --average-
112              rate-window).
113
114       -b, --bytes
115              Turn  the  total  byte  counter on.  This will display the total
116              amount of data transferred so far.
117
118       -8, --bits
119              Display the total bits instead of the total bytes.   The  output
120              suffix will be "b" instead of "B".
121
122       -T, --buffer-percent
123              Turn  on the transfer buffer percentage display.  This will show
124              the percentage of the transfer buffer  in  use  -  but  see  the
125              caveat under %T in the FORMATTING section below.  Implies -C.
126
127       -A, --last-written NUM
128              Show  the  last NUM bytes written - but see the caveat under %nA
129              in the FORMATTING section below.  Implies -C.
130
131       -F, --format FORMAT
132              Ignore the options -p, -t, -e, -r, -a, -b, -T, and -A,  and  in‐
133              stead  use the format string FORMAT to determine the output for‐
134              mat.  See the FORMATTING section below.
135
136       -n, --numeric
137              Numeric output.   Instead  of  giving  a  visual  indication  of
138              progress,  pv  will give an integer percentage, one per line, on
139              standard error, suitable for piping (via convoluted redirection)
140              into  dialog(1).   Note  that  -f is not required if -n is being
141              used.
142
143              Note that if --numeric is in use, then adding --bytes will cause
144              the  number  of bytes processed so far to be output instead of a
145              percentage; if --line-mode is also in use as well as --bytes and
146              --numeric,  then instead of bytes or a percentage, the number of
147              lines so far is output.  And finally, if  --timer  is  added  to
148              --numeric,  then  each  output line is prefixed with the elapsed
149              time so far, as a decimal number of seconds.
150
151       -q, --quiet
152              No output.  Useful if the -L option is being used on its own  to
153              just limit the transfer rate of a pipe.
154
155
156

OUTPUT MODIFIERS

158       -W, --wait
159              Wait  until  the  first byte has been transferred before showing
160              any progress information or calculating any ETAs.  Useful if the
161              program you are piping to or from requires extra information be‐
162              fore it starts, eg piping data into gpg(1)  or  mcrypt(1)  which
163              require a passphrase before data can be processed.
164
165       -D, --delay-start SEC
166              Wait  until  SEC seconds have passed before showing any progress
167              information, for example in a script where you only want to show
168              a  progress bar if it starts taking a long time.  Note that this
169              can be a decimal such as 0.5.
170
171       -s SIZE, --size SIZE
172              Assume the total amount of data to be transferred is SIZE  bytes
173              when  calculating  percentages  and  ETAs.  The same suffixes of
174              "k", "m" etc can be used as with -L.
175
176              If SIZE starts with @, the size of file whose name follows the @
177              will be used.
178
179              Note  that --size has no effect if used with -d PID to watch all
180              file descriptors of a process, but will work with -d PID:FD.
181
182       -l, --line-mode
183              Instead of counting bytes, count lines (newline characters). The
184              progress  bar  will  only move when a new line is found, and the
185              value passed to the -s option will  be  interpreted  as  a  line
186              count.   Note  that  file sizes are not automatically calculated
187              when this option is used, to avoid  having  to  read  all  files
188              twice.
189
190       -0, --null
191              Count   lines   as   null   terminated.    This  option  implies
192              --line-mode.
193
194       -i SEC, --interval SEC
195              Wait SEC seconds between updates.  The default is to update  ev‐
196              ery second.  Note that this can be a decimal such as 0.1.
197
198       -m SEC, --average-rate-window SEC
199              Compute current average rate over a SEC seconds window for aver‐
200              age rate and ETA calculations (default 30s).
201
202       -w WIDTH, --width WIDTH
203              Assume the terminal is WIDTH characters wide, instead of  trying
204              to work it out (or assuming 80 if it cannot be guessed).
205
206       -H HEIGHT, --height HEIGHT
207              Assume  the  terminal  is HEIGHT rows high, instead of trying to
208              work it out (or assuming 25 if it cannot be guessed).
209
210       -N NAME, --name NAME
211              Prefix the output information with NAME.  Useful in  conjunction
212              with  -c  if  you have a complicated pipeline and you want to be
213              able to tell different parts of it apart.
214
215       -f, --force
216              Force output.  Normally, pv will not output any  visual  display
217              if  standard  error is not a terminal.  This option forces it to
218              do so.
219
220       -c, --cursor
221              Use cursor positioning escape sequences instead  of  just  using
222              carriage  returns.  This is useful in conjunction with -N (name)
223              if you are using multiple pv  invocations  in  a  single,  long,
224              pipeline.
225
226
227

DATA TRANSFER MODIFIERS

229       -L RATE, --rate-limit RATE
230              Limit  the  transfer  to  a maximum of RATE bytes per second.  A
231              suffix of "K", "M", "G", or "T" can be added to denote kibibytes
232              (*1024), mebibytes, and so on.
233
234       -B BYTES, --buffer-size BYTES
235              Use  a  transfer  buffer  size of BYTES bytes.  A suffix of "K",
236              "M", "G", or "T" can  be  added  to  denote  kibibytes  (*1024),
237              mebibytes, and so on.  The default buffer size is the block size
238              of the input file's filesystem multiplied by 32 (512KiB max), or
239              400KiB if the block size cannot be determined.  This can be use‐
240              ful on platforms like MacOS which perform  better  in  pipelines
241              with specific buffer sizes such as 1024.  Implies -C.
242
243       -C, --no-splice
244              Never use splice(2), even if it would normally be possible.  The
245              splice(2) system call is a more efficient  way  of  transferring
246              data  from  or  to a pipe than regular read(2) and write(2), but
247              means that the transfer buffer may not be used.   This  prevents
248              -A and -T from working, and makes -B redundant, so using -A, -T,
249              or -B automatically switches on -C.  Switching on -C results  in
250              a small loss of transfer efficiency.  (This option has no effect
251              on systems where splice(2) is unavailable).
252
253       -E, --skip-errors
254              Ignore read errors by attempting to skip past the offending sec‐
255              tions.   The  corresponding  parts  of  the  output will be null
256              bytes.  At first only a few bytes will be skipped, but if  there
257              are  many  errors in a row then the skips will move up to chunks
258              of 512.  This is intended to be similar to dd  conv=sync,noerror
259              but has not been as thoroughly tested.
260
261              Specify  -E twice to only report a read error once per file, in‐
262              stead of reporting each byte range skipped.
263
264       -S, --stop-at-size
265              If a size was specified with -s,  stop  transferring  data  once
266              that  many bytes have been written, instead of continuing to the
267              end of input.
268
269       -Y, --sync
270              After every write operation, synchronise the  buffer  caches  to
271              disk  - see fdatasync(2).  This has no effect when the output is
272              a pipe.  Using -Y may improve the accuracy of the  progress  bar
273              when writing to a slow disk.
274
275       -K, --direct-io
276              Set the O_DIRECT flag on all inputs and outputs, if it is avail‐
277              able.  This will minimise the effect of caches, at the  cost  of
278              performance.   Due to memory alignment requirements, it also may
279              cause read or write failures with an  error  of  "Invalid  argu‐
280              ment",  especially if reading and writing files across a variety
281              of filesystems in a single pv call.  Use this option  with  cau‐
282              tion.
283
284       -d PID[:FD], --watchfd PID[:FD]
285              Instead  of  transferring  data,  watch  file  descriptor  FD of
286              process PID, and show its progress.  The pv  process  will  exit
287              when  FD  either changes to a different file, changes read/write
288              mode, or is closed; other data transfer modifiers -  and  remote
289              control - may not be used with this option.
290
291              If  only  a PID is specified, then that process will be watched,
292              and all regular files and block devices it opens will  be  shown
293              with  a progress bar.  The pv process will exit when process PID
294              exits.
295
296       -R PID, --remote PID
297              If PID is an instance of pv that is already running, -R PID will
298              cause  that instance to act as though it had been given this in‐
299              stance's command line instead.  For example, if pv  -L  123K  is
300              running  with  process  ID 9876, then running pv -R 9876 -L 321K
301              will cause it to start using a rate limit of 321KiB  instead  of
302              123KiB.  Note that some options cannot be changed while running,
303              such as -c, -l, -f, -D, -E, and -S.
304
305

GENERAL OPTIONS

307       -P FILE, --pidfile FILE
308              Save the process ID of pv in FILE.  The file will  be  truncated
309              if  it already exists, and will be removed when pv exits.  While
310              pv is running, it will contain a single number - the process  ID
311              of pv - followed by a newline.
312
313       -h, --help
314              Print a usage message on standard output and exit successfully.
315
316       -V, --version
317              Print  version  information on standard output and exit success‐
318              fully.
319
320
321

FORMATTING

323       If the -F option is given, then the output format is determined by  the
324       given  format  string.  Within that string, the following sequences can
325       be used:
326
327       %p     Progress bar.  Expands to fill the remaining space. Should  only
328              be specified once.  Equivalent to -p.
329
330       %t     Elapsed time.  Equivalent to -t.
331
332       %e     ETA as time remaining.  Equivalent to -e.
333
334       %I     ETA as local time of completion.  Equivalent to -I.
335
336       %r     Current data transfer rate.  Equivalent to -r.
337
338       %a     Average data transfer rate.  Equivalent to -a.
339
340       %b     Bytes transferred so far (or lines if -l was specified).  Equiv‐
341              alent to -b.  If --bits was specified, %b shows the bits  trans‐
342              ferred so far, not bytes.
343
344       %T     Percentage  of  the  transfer  buffer in use.  Equivalent to -T.
345              Shows "{----}" if the transfer is  being  done  with  splice(2),
346              since splicing to or from pipes does not use the buffer.
347
348       %nA    Show  the  last  n  bytes  written  (e.g.   %16A for the last 16
349              bytes).  Shows only dots if the  transfer  is  being  done  with
350              splice(2), since splicing to or from pipes does not use the buf‐
351              fer.
352
353       %N     Name prefix given by -N.  Padded to 9  characters  with  spaces,
354              and suffixed with :.
355
356       %%     A single %.
357
358       The  format string equivalent of turning on all display switches is `%N
359       %b %T %t %r %a %p %e'.
360
361
362

COMMON SWITCHES

364       Some suggested common switch combinations:
365
366
367       pv -ptebar
368              Show a progress bar, elapsed time,  estimated  completion  time,
369              byte counter, average rate, and current rate.
370
371       pv -betlap
372              Show  a  progress  bar, elapsed time, estimated completion time,
373              line counter, and average rate, counting lines instead of bytes.
374
375       pv -t  Show only the elapsed time - useful  as  a  simple  timer,  e.g.
376              sleep 10m | pv -t.
377
378       pv -pterb
379              The  default  behaviour:  progress  bar, elapsed time, estimated
380              completion time, current rate, and byte counter.
381
382
383       On MacOS, it may be useful to specify -B 1024 in a  pipeline,  as  this
384       may improve performance.
385
386
387

EXIT STATUS

389       An exit status of 1 indicates a problem with the -R or -P options.
390
391       Any other exit status is a bitmask of the following:
392
393
394       2      One or more files could not be accessed, stat(2)ed, or opened.
395
396       4      An input file was the same as the output file.
397
398       8      Internal error with closing a file or moving to the next file.
399
400       16     There  was an error while transferring data from one or more in‐
401              put files.
402
403       32     A signal was caught that caused an early exit.
404
405       64     Memory allocation failed.
406
407
408       A zero exit status indicates no problems.
409
410
411

AUTHOR

413       Written by Andrew Wood, with patches submitted by various other people.
414       Please  see  the package's ACKNOWLEDGEMENTS file for a complete list of
415       contributors.
416
417
418

KNOWN PROBLEMS

420       The following problems are known to exist in pv:
421
422       *      In some versions of bash(1) and zsh(1), the construct <(pv file‐
423              name) will not output any progress to the terminal when run from
424              an interactive shell, due to the subprocess being run in a sepa‐
425              rate  process  group  from  the  one that owns the terminal.  In
426              these cases, use --force.
427
428       *      The -c option does not work properly on Cygwin without cygserver
429              running, if started near the bottom of the screen (IPC is needed
430              to handle the terminal scrolling).  To fix this, start cygserver
431              before using pv -c.
432
433       *      The  -R option is not available on Cygwin without cygserver run‐
434              ning (SYSV IPC is needed). To fix this, start  cygserver  before
435              running  the  instance of pv you want, at runtime, to change the
436              parameters of.
437
438       If you find any other problems, please report them.
439
440
441

REPORTING BUGS

443       Report bugs in pv to pv@ivarch.com or use the contact form linked  from
444       the pv home page: <http://www.ivarch.com/programs/pv.shtml>
445
446
447

SEE ALSO

449       cat(1), dialog(1), splice(2), open(2) (for O_DIRECT)
450
451

LICENSE

453       This is free software, distributed under the ARTISTIC 2.0 license.
454
455
456
457Linux                              July 2023                             PV(1)
Impressum