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. There is a fedora RPM package in my packages page for those that are not into compiling it themselves.

Advertisements
Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: