Pipe viewer: Using the pv command on Linux

The pv command is a rather unusual Linux command, but it can provide some insights into commands, especially those that send data through pipes. This includes some visual feedback that can sometimes be very reassuring as it tells you that something is occurring even when you’re sitting and waiting for some output to appear. The name “pv” stands for “pipe viewer” and you should be able to install it with one of these commands:

$ sudo dnf install pv
$ sudo apt -y install pv

When you insert the pv command into a pipeline between two processes, its standard input will be passed through to its standard output and progress will be shown on standard error. It is commonly used to display such things as the time elapsed, the completed progress (percentage bar), the current data transfer speed (also referred to as the throughput rate), the data transferred and the estimated completion time.

In this first example, the pv command with the -p (progress) option is examining a file and sending the data through a pipe to the wc command.



Source link