There are numbers of ways of producing a file copy, compression, deletion, decompression dialog progress in Linux.
I was looking for a new way of doing it (yes, I know about tar’s checkpoint) and other similar methods. I came across a utility called ‘pv’ or Pipe Viewer.

pv – monitor the progress of data through a pipe

pv allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA.
To use it, insert it in a pipeline between two processes, with the appropriate options. Its standard input will be passed through to its standard output and progress will be shown on standard error.
pv will copy each supplied FILE in turn to standard output (- means standard input), or if no FILEs are specified just standard input is copied. This is the same behaviour as cat(1).

root@nitrous:/mnt/oldlinux/var/vhost/gallery/var# tar -cf - albums/ | pv -s $( du -sb albums | awk '{print $1}') | gzip > /backups/gallery_albums.tgz
 311MB 0:00:21 [15.2MB/s] [>                                   ]  2% ETA 0:11:50
root@nitrous:/mnt/oldlinux/var/vhost/gallery/var# tar -cf - albums/ | pv -s $( du -sb albums | awk '{print $1}') | gzip > /backups/gallery_albums.tgz
 3.9GB 0:04:36 [14.9MB/s] [===========>                        ] 36% ETA 0:07:52

Check your distribution repos for the ‘pv’ package. Happy hacking =)

Visited 1 times, 1 visit(s) today