Monitoring a pipe…

It is sometimes needed that you monitor the progress of data through a pipe. After searching around the net, I finally discovered a little terminal-based utility that does exactly that! It’s called Pipe Viewer or just PV. Here is some quick info on how to use this tool.

This program can be inserted into any normal pipeline between two processes to provide visual indication of the progress of data. This is extremely useful when, for example, you use dd to zero-fill a partition or to fill a partition with random data. These operations take rather too long and dd does not provide a visual progress indicator. PV can be inserted between dd input and output, so that it gives some info of the progress of the operation.

Here is what I would use to create an 100MB file full of random data:

# dd if=/dev/urandom bs=1024 count=100000 of=test.file

After hitting the Enter key, you have no clue at what stage this operation is, how fast the file is being created, how long it has taken so far etc.

Inserting PV between dd input and output, all this info is available in real-time:

# dd if=/dev/urandom bs=1024 count=100000 | pv | dd of=test.file

Well, this is just an example. PV proves to be a very useful utility in many cases. Give it a try.

Monitoring a pipe… by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2005 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.