dd built-in progress introduced in coreutils 8.24
git.savannah.gnu.org
git.savannah.gnu.org
`killall -USR1 dd` works like a charm, or for the impatient: watch killall -USR1 dd
Why they didn't give a progress bar in the first place beats me.
I regularly use progress with dd, tar and other utilities.
At least one BSD dd now has a "msgfmt" option that outputs parseable, printf-style format strings.
Truthfully, I prefer it when these basic utilities are static except for fixing bugs. Using the new features in scripts means the scripts might lose some portability.
DESCRIPTION
pv shows the progress of data through a pipeline by giving infor-
mation such as time elapsed, percentage completed (with progress
bar), current throughput rate, total data transferred, and ETA.
To use it, insert it in a pipeline between two processes, with the
appropriate options. Its standard input will be passed through to
its standard output and progress will be shown on standard error.
(edit: formatting) [sc-lx-phys-05 /home/cvogel]
$ dd if=/dev/zero of=/dev/null status=progress
11086075904 bytes (11 GB) copied, 7.000001 s, 1.6 GB/s fprintf (stderr,
_("%"PRIuMAX"+%"PRIuMAX" records in\n"
"%"PRIuMAX"+%"PRIuMAX" records out\n"),
r_full, r_partial, w_full, w_partial);(Unless your `printf` implementation doesn't recognize `"%ju"`, and the `PRIuMAX` macro and friends are defined in some non-standard system-specific manner.)
I guess the answer is that you have to redo the localization for each platform that has a different expansion of PRIuMAX. But that's horrible: the localization will be identical except for the format specifiers, which will just be copied from the English version of the string. Is there support for automating this in the translation toolchain?
(This question is the answer to your question.)
The answer to my question is that xgettext and gettext have special handling for PRIuMAX and the other formatting macros in inttypes.h. http://www.gnu.org/software/gettext/manual/gettext.html#Prep...
dd if=/dev/sda bs=1M | pv > sda.file
or is this better dd if=/dev/sda bs=1M | pv | dd of=sda.file bs=1M pv --buffer-size 1m < /dev/sda > sda.file
http://www.ivarch.com/programs/quickref/pv.shtml -B BYTES, --buffer-size BYTES
Use a transfer buffer size of BYTES bytes. A suffix of "k", "m", "g", or
"t" can be added to denote kilobytes (*1024), megabytes, and so on. The
default buffer size is the block size of the input file's filesystem
multiplied by 32 (512kb max), or 400kb if the block size cannot be
determined.
pv is great tool and works really well. On Linux you can even point it at other process ids, and it will automatically scan their open file descriptors and show progress of relevant ones.I've have similar nightmares about typoing `if` and `of` when using dd.
pv --buffer-size 1m /dev/sda > sda.file
Will do the same thing, and give an accurate % complete progress bar.I'm not sure that's true, last time I tried to do:
pv < /dev/zero > /dev/sda
To zero a drive, it correctly printed out the total size of the output block device. Perhaps it also does this type of scanning on stdin, if possible.That said, looking at the main page, it appears that this functionality is only available for the output end:
Note that if the input size cannot be calculated, and the output is a block device, then the size of the block device will be used and pv will automatically stop at that size as if -S had been given. (http://www.ivarch.com/programs/quickref/pv.shtml)
As an arguement it gives % of the input (64GB usb drive, 8GB image):
> pv /mnt/str/Downloads/stick-8g.img > /dev/sdi
916MiB 0:00:35 [1.88MiB/s] [========> ] 11% ETA 0:04:17
Otherwise it seems to give the size of the output if it's a block device. mv opt=force old=oldname.txt new=/path/to/new.txt
In dd it doesn't matter because it's used for "surgical" jobs where you have to think very carefully about several simultaneous numeric details.I'd make some crude comment about cargo culting, but do you have an explicit complaint? dd itself is derided by the plan9 crew for many more reasons than a progress bar, and the cli arguments are obtuse because they're a joke.
Oh, that's true.
Anyway, what behavior do you want to see exactly? You can still send the USR1 signal and get the update behavior just like before. Were you just pointing out that there are cases where you still need to use that feature, or something else?