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-pfor progress bar,-tfor timer,-efor estimated time remaining, etc.file(s): Specifies the file(s) or input source(s) to read from.
Examples
Monitor progress of a file transfer:
pv source-file > destination-fileThis command will display the progress bar, percentage completed, current data transfer rate, and estimated time remaining for copying
source-filetodestination-file.Pipe data through pv:
tar cf - /path/to/dir | pv | gzip > archive.tar.gzThis example shows how to use
pvto monitor the progress of compressing a directory (/path/to/dir) into a tarball (archive.tar.gz) usinggzip.Monitor data transfer rate:
cat large-file | pv -r > /dev/nullHere,
pv -rdisplays the rate of data transfer fromlarge-fileto/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