How to live monitor dd command progress/output when we write iso/image file?

In this article, we will see an interesting tip how to monitor dd command progress on Linux.

dd command does not produce any output until it completes and generates final stat only.

We can use below command to watch dd command progress.

Watch dd command progress

1. Run a dd command in background.

[root@nglinux ~]# dd if=/dev/zero of=./testimage bs=1M count=8000 &
[1] 15859

2. Now lets watch the command progress.

[root@nglinux ~]# while true; do pgrep dd &> /dev/null && sudo pkill -USR1 dd ; done
421+0 records in
421+0 records out
441450496 bytes (441 MB) copied, 5.33347 s, 82.8 MB/s
427+0 records in
427+0 records out
447741952 bytes (448 MB) copied, 5.45802 s, 82.0 MB/s
434+0 records in
434+0 records out
455081984 bytes (455 MB) copied, 5.58592 s, 81.5 MB/s
440+0 records in
440+0 records out
461373440 bytes (461 MB) copied, 5.70489 s, 80.9 MB/s
445+0 records in
445+0 records out
466616320 bytes (467 MB) copied, 5.80443 s, 80.4 MB/s
451+0 records in
451+0 records out
472907776 bytes (473 MB) copied, 5.93224 s, 79.7 MB/s
458+0 records in
458+0 records out
480247808 bytes (480 MB) copied, 6.05971 s, 79.3 MB/s
463+0 records in
463+0 records out
485490688 bytes (485 MB) copied, 6.16809 s, 78.7 MB/s
469+0 records in
469+0 records out
491782144 bytes (492 MB) copied, 6.28291 s, 78.3 MB/s
476+0 records in
476+0 records out
499122176 bytes (499 MB) copied, 6.41901 s, 77.8 MB/s
481+0 records in
481+0 records out
504365056 bytes (504 MB) copied, 6.51914 s, 77.4 MB/s
487+0 records in
487+0 records out
510656512 bytes (511 MB) copied, 6.64045 s, 76.9 MB/s
^C

3. Now let me kill the command since i ran it for test purpose.

[root@nglinux ~]# kill %1
[root@nglinux ~]# 
[1]+  Terminated              dd if=/dev/zero of=./testimage bs=1M count=8000

I hope you liked the tip.

Do post your comments/suggestions below to improve/enhance the post.

Leave a Reply

Your email address will not be published.