pv
2 min read
pv (Pipe Viewer) monitors the progress of data flowing through a pipeline. Insert it anywhere between two processes and it shows elapsed time, throughput, bytes transferred, a progress bar and an ETA — on stderr, so the data passes through untouched.

Usage
Use it like cat to get a progress bar on a file (size is known, so you get a percentage and ETA):
shell
pv big.iso > /dev/sdX
pv backup.tar.gz | tar xzf -

Drop it into the middle of a pipeline:
shell
tar cf - dir/ | pv | zstd > dir.tar.zst

When reading from a pipe, the total size is unknown — pass it with -s to get a real percentage:
shell
tar cf - dir/ | pv -s $(du -sb dir/ | cut -f1) | gzip > dir.tar.gz

Watch compressed vs. uncompressed rates side by side with named, stacked bars (-c uses cursor positioning so multiple instances don't clobber each other):
shell
pv -cN raw big.log | gzip | pv -cN gz > big.log.gz

Rate-limit a transfer (e.g. to not saturate a link):
shell
pv -L 2m file | ssh host 'cat > file'

Count lines instead of bytes:
shell
some-generator | pv -l > out.txt

Attach to an already-running process and watch its open file descriptors (Linux):
shell
pv -d $(pidof cp)

Options
OptionDescription
-p, --progressShow progress bar
-t, --timerShow elapsed time
-e, --etaShow estimated time remaining
-r, --rateShow current transfer rate
-a, --average-rateShow average transfer rate
-b, --bytesShow total bytes transferred
-n, --numericPrint integer percentages, one per line (for piping into e.g. dialog --gauge)
-q, --quietNo output (useful with -L for pure rate limiting)
-s, --size SIZEAssume total size is SIZE (accepts suffixes like 1g)
-l, --line-modeCount lines instead of bytes
-N, --name NAMEPrefix output with a name
-c, --cursorUse cursor positioning escapes (for multiple pvs in one pipeline)
-L, --rate-limit RLimit transfer to R bytes per second
-B, --buffer-sizeUse a transfer buffer of the given size
-d, --watchfd PIDWatch file descriptors of process PID instead of transferring data
-R, --remote PIDChange the options of an already-running pv (e.g. raise its rate limit on the fly)