progressbar CLI¶
Installing progressbar2 installs a progressbar console script
(progressbar.__main__.main()), plus bar as a shorthand for
the same command in pipelines. It reads from stdin (or one or more
files), writes the same bytes through to stdout (or a file), and draws a
progress bar on stderr while it does – a small, Python-native reimplementation
of the pv (“pipe viewer”) command. Per its own --help text it is
“functional but not yet feature complete”: most flags below are wired up,
but a block of pv-compatible flags is accepted for compatibility and
currently has no effect. The unwired ones are listed as such below.
Worked example¶
curl -sL https://example.com/bigfile.iso \
| progressbar --progress --bytes --rate > bigfile.iso
Reading from stdin means the total size isn’t known up front, so the bar
falls back to a count-only display (no percentage, no bar fill) until it
finishes. If you know the size in advance – from a Content-Length
header, for instance – pass it explicitly so the bar can show a real
percentage and ETA:
curl -sL https://example.com/bigfile.iso \
| progressbar --progress --bytes --eta --size 128m > bigfile.iso
The bar itself always writes to stderr, so it never ends up mixed into the piped stdout data. The equivalent file-based invocation from the project README is:
progressbar --progress --timer --eta --rate --bytes input.bin -o output.bin
Positional and I/O arguments¶
Argument |
What it does |
|---|---|
|
One or more input file paths. Omitted or |
|
Output file path. Defaults to |
|
Assume the total input size is |
|
Count and transfer lines instead of bytes. Input is read and written as text rather than binary. |
|
Read/write in chunks of |
Display switches¶
Toggle which widgets appear. With none of these given, the bar falls back to a built-in default set (percentage/bar/timer/speed when the size is known, count/size/timer otherwise).
Flag |
What it does |
|---|---|
|
Show the percentage and bar widgets. |
|
Show elapsed time. |
|
Show an adaptive ETA ( |
|
Show the ETA as an absolute local time of arrival instead of a countdown. |
|
Show a transfer-speed widget. |
|
Also shows the transfer-speed widget. It currently selects the exact
same widget as |
|
Show the running byte/line count. |
|
Print one line per update instead of overwriting the current line
(equivalent to |
|
Suppress all progress output (uses
|
Accepted, not yet wired up¶
These parse without error but have no observable effect today: -8/
--bits, -T/--buffer-percent, -A/--last-written, -F/
--format.
Output modifiers¶
All accepted for pv compatibility, none wired up yet:
-f/--force, -c/--cursor, -W/--wait,
-D/--delay-start, -0/--null, -i/--interval,
-m/--average-rate-window (see --average-rate above),
-w/--width, -H/--height, -N/--name.
Data transfer modifiers¶
Flag |
What it does |
|---|---|
|
Throttle transfer to |
Also accepted, not wired up: -C/--no-splice,
-E/--skip-errors, -Z/--error-skip-block,
-S/--stop-at-size, -Y/--sync, -K/--direct-io,
-X/--discard, -d/--watchfd, -R/--remote.
General options¶
-h/--help shows the built-in argparse help and exits.
-P/--pidfile is accepted but not wired up.
Exit status¶
A complete copy exits 0, and so does a copy whose reader goes away
early (progressbar big.bin | head): the bar is finished quietly and
nothing is printed about the broken pipe. An invalid size value, a
missing, unreadable or directory input, a directory as output, or an
output path that is also one of the inputs is reported before the output
file is opened, so the output is left untouched, and the command exits
2 like any other usage error. Ctrl-C finishes the bar and exits
130.