Showing file operation progress in Linux

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…

Posted in Linux, Uncategorized
One comment on “Showing file operation progress in Linux
  1. […] to a DVD or a USB thumb drive, which you can then use to install wherever you’d like. I did a blog post on how to do that from Linux. The .iso file will be in the ./images/ folder from where you last left […]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

%d bloggers like this: