pip install tqdmcat "${FILE}" | tqdm --bytes | gzip -c - > "${FILE}.gz"Output sample:
22.6MB [00:03, 7.74MB/s]In order to have a progress bar with completeness, throughput and ETA, you need to provide the total size --total=XX.
As the output size of the gzipped file is not known, I rely on the input size.
cat "${FILE}" \
| tqdm --total=$(stat --printf="%s" "${FILE}") --bytes \
| gzip -c - \
> "${FILE}.gz"Output sample:
22%|██████████████▎ | 168M/760M [00:00<00:01, 367MB/s]
56%|████████████████████████████████████▍ | 426M/760M [00:01<00:00, 379MB/s]
80%|███████████████████████████████████████████████████▊ | 606M/760M [00:01<00:00, 377MB/s]
100%|█████████████████████████████████████████████████████████████████| 760M/760M [00:02<00:00, 372MB/s]function gzipbar {
cat "${1}" \
| tqdm --total=$(stat --printf="%s" "${1}") --bytes \
| gzip -c - \
> "${1}.gz"
}-
You may use your favorite compression software. Briefly tested with
gzip -c -bzip2 -c -xz -c -python -m pgzip -t 32 -(some delays are observed)
-
You may custom the
tqdmprogressbar with--desc--mininterval--maxinterval
See
tqdm -hfor more. -
You may also be interrestd in
pvfor progress reporting.