In this writeup, we will discuss the way to monitor the progress of data using the pv command.
How to Monitor the Progress of Data on Raspberry Pi using āpvā Command?
In the Raspberry Pi system, the pv is not pre-installed but it can be downloaded easily using the apt package management tool.
Install pv on Raspberry Pi
Follow the below-given steps to install pv on Raspberry Pi:
Firstly, update/upgrade the repository using the below-written command:
$ sudo apt upgrade
Then install pv from the Raspberry Pi repository using the below-written command:
Verify the installation of pv by running the below-written command:
pv Command Syntax
There are different syntaxes, which can be followed to use the pv utility, such as:
Syntax 1
This syntax is used when the content of one file is required to be copied into another location or file:
Syntax 2
This syntax is used when two commands are piped together, in which the output of first command act as an input to the next command:
How to Use pv Utility to Monitor Progress
Now letās see how you can use the pv command to monitor the progress of different processes like the copying process, creating a backup or compressing the data.
1: Monitor Progress While Copying the Data
To get to know about the progress while copying content from one file to another, you can follow the syntax 1, which is already mentioned in the article:
Example
Script.py is my file which I have copied in documents using the above written command:
You will see the progress of the file on the terminal. The same command can be followed for other files too.
2: Monitor Progress While Compressing the Data
To monitor the progress of a data compression process, the users can use the following pipeline command with pv, and as an output the percentage of deflation will also display on the terminal:
3: Monitor Progress While Backing Up the Data
To monitor the progress while creating a backup for a directory, just run the below-written command:
The above command displays the progress of data backup by setting up the timer and shows you the data transfer rate during the file backup.
To find out detail about different pv options, open the manual on the terminal using the following command:
Read out the manual to get used to the pv command if you are new to it.
Conclusion
To monitor the progress of data, the pv (pipe viewer) utility is used, which can be installed by using the apt command. The pipe viewer command has different syntaxes which are discussed in the article. Also, there are different options/modifiers which can be used with the pv command to perform the desired operation for the progress bar.