If you wanted to burn an ISO to a thumb drive in Linux, you’d typically use “dd”. That might look something like this:
sudo dd if=~/Downloads/kali-linux-2016.1-amd64.iso of=/dev/sdb bs=512k
This copies the input file of the .iso, to the output “file” of the /dev/sdb device, which is my thumb drive. The problem is, when you run this, it just sits there for like :02 whole minutes, and it doesn’t show any status.
Well, there is another command called “pv” where you can monitor the progress of data through a pipe. Now, “dd” is already self-contained, so how to inject this monitor in-between? Most programs allow you to feed input to it from the console, or “pipe” it to the program. So, you can kick off “pv”, have it open and feed the file through the pipe, and show progress, while the secondary program is running (“dd”, in this case).
Using “pv” to show the status of the operating, the same command above, now looks like this:
sudo pv -tpreb ~/Downloads/kali-linux-2016.1-amd64.iso | sudo dd of=/dev/sdb bs=512k
So “pv” opens the file (the -tpreb are for formatting), and the contents of that file are piped to “dd”. Now, when it runs, I see progress like this:
2.74GiB 0:00:14 [18.2MiB/s] [=====================> ] 44% ETA 0:00:17
Not only did this solve this immediate “problem”, this has some other implications. Any time you are moving, copying, or processing a file in any way, you could potentially use “pv” to show the status. You can even pipe this to “dialog” which will show a text dialog box with a status bar too. Very cool!
So, since Future Robert will likely need this in the future, I thought I’d write it down here. Got any other useful command line tools like this? Leave a comment below…