pv Command: Tutorial & Examples
Monitor the progress of a pipe
The pv
command in Linux is a command-line utility that can be used to monitor the progress of data that is being piped between commands. It can be used to
track the progress of data as it is being transferred, such as during a file copy or data compression operation.
Here are some examples of using the pv
command:
To monitor the progress of a file copy operation, you can use the command:
pv file1 > file2
This will display a progress bar with information about the number of bytes transferred, the transfer rate, and the estimated time remaining.
To monitor the progress of a data compression operation, you can use the command:
pv file1 | gzip > file2.gz
This will display a progress bar with information about the number of bytes transferred, the transfer rate, and the estimated time remaining, as the data is being compressed using
the gzip
command.
The pv
command can also be used in conjunction with other commands, such as dd
and tar
, to monitor the progress of data as it is
being transferred or manipulated. It is particularly useful when working with large files or when transferring data over a slow network connection.