How to show a progress bar when extracting a file

Recently, I found about a nice tool for showing the progress when extracting a compressed tar file on the command line: pv. pv monitors the progress of data as it goes through a pipe, so we need to send the file to tar using a pipe:

$ pv file.tgz | tar xzf - -C target_directory

This will show elapsed time, percentage completed with a progress bar and an estimated time to completion (ETA), something like this

1.16MB 0:00:20 [6.06MB/s] [==================>               ] 55%  ETA 0:00:37

Some more info about pv and examples at: A Unix Utility You Should Know About: Pipe Viewer.

 

Nicer progress bar using dialog



The command above showed very useful, but I wanted to be able to show the progress of extraction using dialog. This is an example script of a progress bar using dialog:
Continue reading How to show a progress bar when extracting a file