How to Monitor Progress Of A Linux Command Using ‘pv’

How to monitor progress of Linux commands. Install and use pv command on Ubuntu Systems to monitor the progress of data through a pipe. An easy way to monitor progress of a Linux command line operation.

pv – monitor the progress of data through a pipe

pv allows a user to see the progress of data through a pipeline. pv command displays the following information about the process being executed:

  • Time elapsed
  • Percentage completed (with progress bar)
  • Current throughput rate
  • Total data transferred
  • ETA

Install pv Command in Ubuntu

install-pv

pv command is not installed by default on Linux Ubuntu Systems. In order to install pv command, run the following code:

sudo apt-get install pv

Once installed, you can check the version of pv command installed on the system. Run the command pv -V (please note capital V) to find the version.

Using pv Command

pv command in easy to use. It can be used by placing it in a pipeline between two processes. The command supports many file options. To use it, insert it in a pipeline between two processes, with the appropriate options. Its standard input will be passed through to its standard output and progress will be shown on standard error. pv will copy each supplied FILE in turn to standard output (- means standard input), or if no FILEs are specified just standard input is copied.

The standard syntax of pv command is:

Usage:

  • pv [FILE]
  • pv [OPTION] [FILE]…

pv-man-page

Various options that can be used with pv command are:

-p, –progress show progress bar
-t, –timer show elapsed time
-e, –eta show estimated time of arrival (completion)
-I, –fineta show absolute estimated time of arrival (completion)
-r, –rate show data transfer rate counter
-a, –average-rate show data transfer average rate counter
-b, –bytes show number of bytes transferred
-T, –buffer-percent show percentage of transfer buffer in use
-A, –last-written NUM show NUM bytes last written
-F, –format FORMAT set output format to FORMAT
-n, –numeric output percentages, not visual information
-q, –quiet do not output any transfer information at all
-W, –wait display nothing until first byte transferred
-D, –delay-start SEC display nothing until SEC seconds have passed
-s, –size SIZE set estimated data size to SIZE bytes
-l, –line-mode count lines instead of bytes
-0, –null lines are null-terminated
-i, –interval SEC update every SEC seconds
-w, –width WIDTH assume terminal is WIDTH characters wide
-H, –height HEIGHT assume terminal is HEIGHT rows high
-N, –name NAME prefix visual information with NAME
-f, –force output even if standard error is not a terminal
-c, –cursor use cursor positioning escape sequences
-L, –rate-limit RATE limit transfer to RATE bytes per second
-B, –buffer-size BYTES use a buffer size of BYTES
-C, –no-splice never use splice(), always use read/write
-E, –skip-errors skip read errors in input
-S, –stop-at-size stop after –size bytes have been transferred
-R, –remote PID update settings of process PID
-P, –pidfile FILE save process ID in FILE
-d, –watchfd PID[:FD] watch file FD opened by process PID
-h, –help show this help and exit
-V, –version show version information and exit

Please note that when no option is given with the pv command it run with default -p (progress), -t (timer), -e (ETA), -r (rate) and -b (bytes) options.

How to Monitor Progress Of A Linux Command Using ‘pv’ originally posted on Source Digit – Latest Technology, Gadgets & Gizmos.