the dd command certainly has it varied uses, and is a vary well used (and loved AND hated) command. My only one gripe about the command, is that there is no status indicator; nothing to tell how you how far along you are, how much is left, or if the command is even still working. Well, there is a way to get a progress bar... Read on for how.

Before we begin, let us take a look at a basic dd command:

dd if=/dev/sda of=/dev/sdb

So here we are copying /dev/sda to /dev/sdb; a complete disk image. If these are tiny devices, less than 1GB in size, this will be reasonably quick command. But if we have any more, or even terabytes, this will take a LONG time. So it would be nice to at least see a progress bar, if for no other reason than to know that progress is indeed being made. Enter the pv (Pipe Viewer) command:

pv -tpreb /dev/sda | dd of=/dev/sdb bs=64M

This will give you a progress bar similar to this:

50.9MiB 0:00:09 [5.29MiB/s] [=========>                                                               ]  1% ETA 0:07:42

Now, this isn't the ONLY way to use the pv command... Another option is this:

dd if=/dev/sda | pv | of=/dev/sdb

But this won't give you some of the nice detail like an ETA, or how much is remaining... You will need to include some file size calculations and stuff, and I'm WAY too lazy for THAT, especially when the pv command itself, when used as ths source, will do so automatically for you!

Let me know what other similar commands you use in the comments below.

Add comment

Security code