DD getting progress status

There are a few ways you can get progress/status of your dd command. Here are 3 examples I know:

Using pv

Install pv (pv - monitor the progress of data through a pipe):

sudo apt install pv

Now you can pipe your dd command to see progress:

dd bs=1M count=6000 if=/dev/zero | pv | dd of=test conv=fdatasync
370MiB 0:00:02 [ 178MiB/s] [  <=>                                           ]

Also you can get estimated time if you specify file size:

dd bs=1M count=6000 if=/dev/zero | pv -s 6G | dd of=test conv=fdatasync
888MiB 0:00:04 [ 239MiB/s] [=======>                        ] 14% ETA 0:00:23

This is the one I use. It looks a lot better then the others :)

Making alias command

Also you can create command called mydd in .bashrc. Just add into file ~/.bashrc:

alias mydd='while kill -USR1 $(pidof dd) ; do sleep 1 ; done'

Then reload .bashrc:

source ~\.bashrc

Now run dd with extra command:

dd bs=1M count=6000 if=/dev/zero of=test conv=fdatasync & mydd

Now depending on the sleep you specified it will output current status of dd command every # sec in the same stdout where dd is running.

Using new status option in dd (>8.24)

dd in GNU Coreutils 8.24+ got a new status option to display the progress. You can check your version with:

dd -version
dd (coreutils) 8.26
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
< http://gnu.org/licenses/gpl.html >
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, and Stuart Kemp.

So to use status option just add status=progress to your dd command:

dd bs=1M count=6000 if=/dev/zero of=test conv=fdatasync status=progress
5281677312 bytes (5.3 GB, 4.9 GiB) copied, 10.0102 s, 528 MB/s