Track cpio Copy Progress with pv command
As part of configuring email archive with OfflineIMAP and Neomutt, I’m experimenting with downloading my gSuite mailbox onto XPS laptop running Ubuntu 19.04. Today I needed to copy the large (30GB) directory with all the downloaded messages and realised it’s a lot more fun watching copy process with pv command.
pv command basics
pv command aims to help you visually report progress of data transfer processes. You pipe output of one of the commads into pv and then pipe pv’s output into the next command. Sitting in the middle of two data transfer commands, pv reports amounts and throughput of data flow.
Using pv with cpio
greys@xps:~/Mail $ find techstack | pv | cpio -pdum techstack.bak
sc1.07MiB 0:00:08 [57.4KiB/s] [ <=> ^C18MiB 0:00:09 [ 117KiB/s] [ <=> ]
greys@xps:~/Mail $ rm -rf techstack.bak/
greys@xps:~/Mail $ find techstack | pv | cpio -pdum techstack.bak
^C59MiB 0:01:38 [69.2KiB/s] [ <=> ]
greys@xps:~/Mail $ du -sh techstack.bak/
5.7G techstack.bak/
greys@xps:~/Mail $ rm -rf techstack.bak/
greys@xps:~/Mail $ find techstack | pv | cpio -pdum techstack.bak
35.7MiB 0:04:44 [ 128KiB/s] [ <=> ]
54212243 blocks
greys@xps:~/Mail $