top of page
  • Kathryn Hedley

Using Pipe Viewer to calculate progress

How many times have you run a dd command and sat wondering how much longer it's going to take to complete? Maybe you're sat there with another Terminal windows open running 'ls -al' incessantly to monitor the size of the output file? This was me until I discovered the 'pv' command; rather later in life than I'd have liked.

Pipe Viewer (pv) is a Linux tool that simply monitors data being passed through a pipe and provides a progress bar.

I have since found many, many uses for this tool and wanted to share a few of my highlights so far:

  • DD imaging: pv -pt | dd of=/dev/image.dd

  • DD imaging over netcat: (listener) dd if=/dev/sda | pv | nc -l -p <port> (receiver) nc <IP> <port> | pv | dd of=image.dd

  • Create a TAR archive: tar -cf - <folder> | pv -s $(du -sb <folder> | awk '{print $1}') > file.tar


bottom of page