Pipe Viewer (pv) is Pretty Swell

A pretty common task in my workflow is updating my development database to what's currently on the live servers. The database isn't too large, but it does take about 30 seconds to import -- and I do positively loathe not knowing what's going on. Enter pipeviewer! I remembered reading a post that was linked off reddit some number of internet decades ago.

With this mighty tool in hand, I set to apply it to those 30 seconds of terrifying mystery that MySQL was plaguing my dreams with.

pv databasedump.sql | mysql -uDATABASEUSER -p databasename

And like magic, a beautiful progress bar was rendered. Life had incrementally improved.

I'd also recently used pv to watch the progress of dd-ing an ISO onto a USB stick, like so:

pv -ptre ubuntu-10.04-desktop-i386.iso | dd of=/dev/disk1 bs=1mb
  • The "-ptre" turns on all the rate monitors and progress bars and such.
  • /dev/disk1 is where OSX had my USB stick mounted.
  • bs=1mb sets the blocksize of dd to 1 megabyte, which made the copying process go a lot faster (minutes instead of hours.)