testing pv with ncurse dialog UI

Thursday September 4, 2014

dd is not convenient to some extent because there is no built-in progress bar. So here’s how to make it smarter.

brew install pv
brew install dialog

Before going further, thanks to this thread on AskUbuntu for the tips. From the thread, seems like the most viable way of getting a progress bar for dd is to use the pv (short-form for pipe viewer). To achieve this on Linux/OSX, pv must be installed first.

After the second thought, how about if I parse the output from pv to the dialog, because it seems much more fun that way.

(pv -n xubuntu-14.04-desktop-amd64.iso | sudo dd of=/dev/disk2) 2>&1 | dialog --gauge "Running dd command (burning), please wait..." 10 70 0

Here’s the breakdown of the command:

pv: self-explanatory. sudo dd: running dd to write the .iso with root permission. dialog: the ncurse tool to display progress bar. (...): to encapsulate both commands into single unit (I guess). 2>&1: to merge 2 commands into single (I guess). 10 70 0: honestly, no idea… but it works!

Baboom!!

parsing pv output to dialog

If the ncurse is kinda overkill, here’s a simpler command that works without the ncurse. Thanks Faiz!

sudo dd if=ubuntu.iso | pv --size 623M | sudo dd of=/dev/disk2

pv has a cousin, and its name is cv. Grab the code here on GitHub.