12

I need to encrypt a large file using gpg. Is it possible to show a progress bar like when using the pv command?

Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
Antoine
  • 1,021
  • 1
  • 12
  • 13

2 Answers2

16

progress can do this for you — not quite a progress bar, but it will show progress (as a percentage) and the current file being processed (when multiple files are processed):

gpg ... &
progress -mp $!
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
3

It's entirely possible to use the pv in combination with gpg, and I see no reason why it should be avoided, some real example I'm just running now follows:

gpg_fingerprint='055667909AA5B877B2A47BC34311D0FB042CB88F'
file_name='linux-mint-20_timeshift_2020-10-13_11-39-29.tar.bz2'

pv < "$file_name" | gpg \
--compress-algo none \
--cipher-algo aes256 \
--digest-algo sha512 \
--local-user "$gpg_fingerprint" \
--recipient  "$gpg_fingerprint" \
--encrypt-files - > "$file_name".gpg
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309