Show statistics in dd

When dd is done with copying data, it prints statistics that show the amount of copied data and the transfer rate such as in the following example:

$ dd if=/dev/zero of=/tmp/fileWithZeros bs=1M count=2
 2+0 records in
 2+0 records out
 2097152 bytes (2,1 MB) copied, 0,00179993 s, 1,2 GB/s

When dd receives the signal USR1 while it is running, it prints its current progress in the same format. For testing, start a process that copies data from /dev/zero to a new file (/tmp/fileWithZeros) indefinitely:

dd if=/dev/zero of=/tmp/fileWithZeros

Afterwards, open second terminal and execute

killall -USR1 dd

In the first terminal, dd prints transfer statistics to standard error. The process can be automatized with the following command (e.g. every 3 seconds)

watch --interval 3 killall -USR1 dd

References

  • [1] Detailed description of dd in Wikipedia
  • [2] Blog article with instructions how to send the USR1 signal to dd

Leave a Reply