pv

the pv command, which is used to monitor the progress of data through a pipeline. Here's an overview of pv:

pv stands for "Pipe Viewer". It allows you to monitor the progress and throughput of data as it passes through a pipeline, which can be useful for tasks involving data transfer, backups, and other operations where progress tracking is beneficial.

Basic Usage

The basic syntax of pv is:

pv [options] [file(s)]
  • Options: Various options can be used to customize the behavior of pv, such as -p for progress bar, -t for timer, -e for estimated time remaining, etc.

  • file(s): Specifies the file(s) or input source(s) to read from.

Examples

  1. Monitor progress of a file transfer:

    pv source-file > destination-file

    This command will display the progress bar, percentage completed, current data transfer rate, and estimated time remaining for copying source-file to destination-file.

  2. Pipe data through pv:

    tar cf - /path/to/dir | pv | gzip > archive.tar.gz

    This example shows how to use pv to monitor the progress of compressing a directory (/path/to/dir) into a tarball (archive.tar.gz) using gzip.

  3. Monitor data transfer rate:

    cat large-file | pv -r > /dev/null

    Here, pv -r displays the rate of data transfer from large-file to /dev/null.

Key Features

  • Progress Indicator: Shows a progress bar (-p), percentage completed, current throughput rate (-r), and estimated time remaining (-e).

  • Timer: Displays elapsed time (-t) and total data transferred (-s).

  • Customization: Various options allow customization of the output format and behavior to suit specific needs.

  • Compatibility: Works with any command that sends data through a pipeline (|), making it versatile for monitoring data flow in different scenarios.

Conclusion

pv is a versatile command-line utility for monitoring data progress through pipelines in Linux. Whether you're copying files, creating backups, or performing data transfers, pv provides real-time feedback on throughput and progress, enhancing visibility and control over these operations. Refer to man pv for a detailed list of options and usage examples tailored to your specific requirements.

Last updated