Monitoring Large File Copies with Bash and Awk

I recently came across a server that did not have iostat available and I needed estimate when a certain file copy would complete. In order to make a rough estimate I wrote the following one-liner to summarize the available space in the current working directory, wait a minute and then sum again, subtracting the smaller value from the larger value to determine how many megabytes per minute.

while :; do CUR=$(du -ms | awk {'print $1'}) ; sleep 60; NEXT=$(du -ms | awk {'print $1'}) ; echo $(( $NEXT - $CUR)) ; done

You could reduce the sleep value to 1 show megs per second but you will probably reduce the speed of your copy. Sixty seconds seemed like a good medium and makes it easy to estimate. Generally I can wait about 5 minutes and pretty accurately generate an expected time to completion. I'm sure there's a way to do it with IFS and have bash do the splitting but it was quicker for me to just use Awk.